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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/proto-gae/proto_gae.go » ('j') | tools/proto-gae/proto_gae.go » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 proto-gae
2 =========
3
4 proto-gae is a simple `go generate`-compatible tool for generating
5 "github.com/luci/gae/service/datastore".PropertyConverter implementation for
6 `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.
7 implementations into your datastore models.
8
9 The generated implementations serialize to/from the binary protobuf format into
10 an unindexed []byte property.
11
12
13 Example
14 -------
15
16 #### path/to/mything/protos/mything.proto
17 ```protobuf
18 syntax = "proto3";
19 package protos;
20 message MyProtoThing {
21 my string = 1;
22 proto int64 = 1;
23 thing float = 1;
24 }
25 ```
26
27 #### path/to/mything/protos/gen.go
28 ```go
29 package protos
30 // assume github.com/luci/luci-go/tools/cmd/cproto is in $PATH. Try it, it's
31 // awesome :).
32
33 //go:generate cproto
34 //go:generate proto-gae -type MyProtoThing
35 ```
36
37 #### path/to/mything/thing.go
38 ```go
39 package mything
40
41 import "path/to/package/protos"
42
43 type DatastoreModel struct {
44 // This will now 'just work'; ProtoMessage will round-trip to datastore as
45 // []byte.
46 ProtoMessage protos.MyProtoThing
47 }
48 ```
OLDNEW
« 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