Does grpc-gateway integrate with any ORMs, such as go-pg? For instance, is it possible to annotate a protobuf message with an option to specify SQL-specific properties on the generated Go model? If not, is this the sort of thing that the maintainers would consider accepting a pull request for?
Does grpc-gateway integrate with any ORMs, such as go-pg?
No.
For instance, is it possible to annotate a protobuf message with an option to specify SQL-specific properties on the generated Go model?
Yes. https://developers.google.com/protocol-buffers/docs/proto#extensions . You don't need any special support or dependency on this project. Define your field level proto extensions, then write your glue code to use some ORM layer.
I guess @DanForbes is talking about something like https://github.com/golang/protobuf/issues/52.
https://github.com/favadi/protoc-go-inject-tag in particular.
And as @tamalsaha said, it does not need any special support in this project.
Thank @yugui . I did not know about this injector thing. But this is probably never going to be supported by the official protobuf team.
I was talking more about field level annotations like http://godoc.org/github.com/gogo/protobuf/gogoproto
message A {
optional string Description = 1 [(gogoproto.nullable) = false];
optional int64 Number = 2 [(gogoproto.nullable) = false];
optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false];
}
ref: https://github.com/gogo/protobuf/blob/master/extensions.md
I would think it will be possible to take those annotations and then call some ORM code in some glue code.
Cool, thanks for the insights, guys! I'll look into your suggestions.