Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datastore: support conversion of protobuf ptypes directly #680

Closed
ptone opened this issue Jun 24, 2017 · 3 comments
Closed

datastore: support conversion of protobuf ptypes directly #680

ptone opened this issue Jun 24, 2017 · 3 comments
Assignees
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.

Comments

@ptone
Copy link

ptone commented Jun 24, 2017

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.

@jba jba self-assigned this Jun 27, 2017
@jba jba added api: datastore Issues related to the Datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jun 27, 2017
@jba
Copy link
Contributor

jba commented Jun 27, 2017

I don't think the proto compiler will be changed to use native types. But writing a sample is definitely do-able.

@jba jba added the help wanted We'd love to have community involvement on this issue. label Aug 22, 2017
@jba
Copy link
Contributor

jba commented Dec 14, 2017

@jba jba closed this as completed Dec 14, 2017
@timothyleung1
Copy link

timothyleung1 commented Feb 24, 2020

I just store them directly in the datastore and it seems to work. It will create some weird fields such as XXX_cachsize etc tho..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants