gnormal/gnorm

Is there a Protobuf example?

mmendez512 opened this issue ยท 8 comments

My team has a brand new microservice project where we want to generate our go db models and protobuf files (for grpc) directly from the db schema.

On the gnorm site, it mentions we can generate protobufs from templates. I'm just curious if there's a simple example on how to do this.

Thanks.

freb commented

I generate a proto file using Gnorm. It outputs message types for each table and additional messages to support the request and response messages for the CRUD RPCs it also generates. If you're just looking for message generation, the template could be paired down.

I'd be happy to prepare a PR for an example if @natefinch is open to accepting it. Otherwise I'm happy to just upload the config and template file here.

I would welcome a PR for generating gRPC. :)

Thanks @freb!!

freb commented

@natefinch where should I add the example, to the gnormal/postgres-go? The GRPC example requires an additional toml file and the example already there is at the root of the repo. I wasn't sure if this would be confusing. Let me know what you think.

freb commented

Thanks guys! Going to close out this issue now there's a PR open.