Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Unified Diff: tools/proto-gae/README.md

Issue 1625773002: Add tool to generate PropertyConverter implementations for proto messages. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/proto-gae/proto_gae.go » ('j') | tools/proto-gae/proto_gae.go » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/proto-gae/README.md
diff --git a/tools/proto-gae/README.md b/tools/proto-gae/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..41c431139cded0879c2885ace00e2973ffcbf7b7
--- /dev/null
+++ b/tools/proto-gae/README.md
@@ -0,0 +1,48 @@
+proto-gae
+=========
+
+proto-gae is a simple `go generate`-compatible tool for generating
+"github.com/luci/gae/service/datastore".PropertyConverter implementation for
+`protoc`-generated message types. This allows you to embed proto.Message
dnj 2016/01/23 06:15:36 nit: Back-ticks around proto.Message
iannucci 2016/01/23 10:01:07 Done.
+implementations into your datastore models.
+
+The generated implementations serialize to/from the binary protobuf format into
+an unindexed []byte property.
+
+
+Example
+-------
+
+#### path/to/mything/protos/mything.proto
+```protobuf
+syntax = "proto3";
+package protos;
+message MyProtoThing {
+ my string = 1;
+ proto int64 = 1;
+ thing float = 1;
+}
+```
+
+#### path/to/mything/protos/gen.go
+```go
+package protos
+// assume github.com/luci/luci-go/tools/cmd/cproto is in $PATH. Try it, it's
+// awesome :).
+
+//go:generate cproto
+//go:generate proto-gae -type MyProtoThing
+```
+
+#### path/to/mything/thing.go
+```go
+package mything
+
+import "path/to/package/protos"
+
+type DatastoreModel struct {
+ // This will now 'just work'; ProtoMessage will round-trip to datastore as
+ // []byte.
+ ProtoMessage protos.MyProtoThing
+}
+```
« no previous file with comments | « no previous file | tools/proto-gae/proto_gae.go » ('j') | tools/proto-gae/proto_gae.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698