datastore: support conversion of protobuf ptypes directly #680
Labels
api: datastore
Issues related to the Datastore API.
help wanted
We'd love to have community involvement on this issue.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Consuming protobufs in an API (gRPC or otherwise) and then storing them in datastore is a really effective pattern, with a catch.
Protobuf supports some interesting ptypes for richer datatypes, such as timestamp, and duration.
These convert directly into similar verbose struct types in golang protobuf, but there exist helper utils to convert to native golang types
https://github.com/golang/protobuf/blob/master/ptypes/duration.go
https://github.com/golang/protobuf/blob/master/ptypes/timestamp.go
A proposal for similar support for structs was rejected
golang/protobuf#370
For these relatively limited number of ptypes, it would be nice if the conversion to golang native type, and then into datastore type was handled more easily, or perhaps an sample showing a protobuf PropertyLoadSaver implementation.
The text was updated successfully, but these errors were encountered: