在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):danielvladco/go-proto-gql开源软件地址(OpenSource Url):https://github.com/danielvladco/go-proto-gql开源编程语言(OpenSource Language):Go 97.7%开源软件介绍(OpenSource Introduction):Protoc plugins for generating graphql schema and go graphql code If you use micro-service architecture with grpc for back-end and graphql api gateway for front-end, you will find yourself repeating a lot of code for translating from one transport layer to another (which many times may be a source of bugs) This repository aims to simplify working with grpc trough protocol buffers and graphql by generating code. Install:go install github.com/danielvladco/go-proto-gql/protoc-gen-gql
go install github.com/danielvladco/go-proto-gql/protoc-gen-gogql Usage Examples:The protoc compiler expects to find plugins named export PATH=${PATH}:${GOPATH}/bin
Example: protoc --gql_out=paths=source_relative:. -I=. -I=./example/ ./example/*.proto If you still want to generate go source code instead of graphql then use
http://github.com/99designs/gqlgen plugin, and map all the generated go types with all the generated graphql types.
Luckily
This plugin also creates convenience methods that will implement generated by the Example: protoc --gogql_out=gogoimport=false,paths=source_relative:. -I=. -I=./example/ ./example/*.proto See Gateway (alpha)A unified gateway is also possible. Right now a gateway can be spawn up
pointing to a list of grpc endpoints (grpc reflection must be enabled on the grpc servers).
The gateway will query the servers for protobuf descriptors and generate a graphql schema abstract tree.
The requests to the gateway will be transformed on the fly to grpc servers without any additional code generation
or writing any code at all. See Community:Will be very glad for any contributions so feel free to create issues, forks and PRs. License:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论