summaryrefslogtreecommitdiff
path: root/auto.proto
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-09 15:03:05 -0600
committerJeff Carr <[email protected]>2025-01-09 15:03:05 -0600
commitff1721c250420fb4f1ce24f13d2e20721e40a07b (patch)
tree3a61ac908c628077368ad27158746b726f0a5659 /auto.proto
parente725c0cc8011ab6d2c418f83d9b86c7897fabef4 (diff)
compiles again
Diffstat (limited to 'auto.proto')
-rw-r--r--auto.proto61
1 files changed, 13 insertions, 48 deletions
diff --git a/auto.proto b/auto.proto
index a19afa6..87e6836 100644
--- a/auto.proto
+++ b/auto.proto
@@ -1,5 +1,9 @@
syntax = "proto3";
+// Look at "example/fruit.proto" not this file
+
+// this file is actually used by autogenpb
+
// here are some docs, but probably it's just easier to run
// autogenpb on this file and see what gets autogenerated
// in this directory. All autogenerated files are named *.pb.go
@@ -15,26 +19,6 @@ syntax = "proto3";
package main;
-message Apple { // `autogenpb:marshal`
- string name = 1; // `autogenpb:unique` // generates SortByxxx() and AppendUnique() functions
- string genus = 2; // `autogenpb:unique` // generates same thing here but SortByGenus()
-}
-
-message Apples { // `autogenpb:marshal` `autogenpb:mutex`
- string uuid = 1; // `autogenpb:default:b2a2de35-07b6-443b-8188-709e27bee8a7`
- string version = 2; // `autogenpb:default:2`
- repeated Apple Apples = 3; // `autogenpb:sort`
- repeated Pears More = 4; // `autogenpb:sort`
- repeated string Color = 5; // `autogenpb:sort` `autogenpb:unique`
-}
-
-message Pears {
- string name = 1; //
- string favorite = 2; // `autogenpb:sort`
-}
-
-// above is an example
-
//
// below are the actual structs autogen uses
// autogen parses the .proto file and then store the information
@@ -42,34 +26,13 @@ message Pears {
// protobuf files to write out *.sort.pb.go and *.marshal.pb.go files
//
message MsgName {
- // If you have:
- //
- // "Shelf" for msgname
- // "Books" for name
- //
- // Then in the proto file, that would mean it would look like:
- //
- // message Shelf {
- // and then
- // repeated string Books = 42;
- //
- // autogenpb will then generate sort functions for each 'name'
- // things like:
- //
- // for _, b := range all.Book {
- //
- // and sort functions like:
- //
- // func (a ShelfBook) Less(i, j int) bool { return a[i].Book < a[j].Book }
- //
-
string name = 1; // the name of the message aka struct. for this example: "Shelf"
- string lockname = 2; // ShelfMU
- bool doMarshal = 3; // if "Shelf" should have Marshal & Unmarshal functions
+ string lockname = 2; // name of the lockfile. ends in Mu
+ bool doMarshal = 3; // if msg struct should have Marshal & Unmarshal functions
bool doMutex = 4; // true if a mutex is needed for the message struct
bool doProtocMutex = 5; // an experiment to insert a mutex into the protoc generated msg struct (bad idea?)
bool mutexFound = 6; // true if the mutex was added to the protoc pb.go file
- repeated string sort = 7; // "Book", "Picture", etc
+ repeated string sort = 7; // keys to sort on
repeated string unique = 8; // if the fields should have AppendUnique() functions
}
@@ -79,10 +42,12 @@ message File { // `autogenpb:nomarshal`
string pbfilename = 3; // yellow.pb.go
string filebase = 4; // yellow
string uuid = 5; // the uuid to use in a func NewMsgName()
- int64 version = 6; // the version to use in a func NewMsgName()
+ string version = 6; // the version to use in a func NewMsgName()
+ MsgName bases = 7; // the message in "plural" form
+ MsgName base = 8; // the primary repeated message for the master struct
// every struct in this proto file, this file has: "Apple", "Apples", ... "File", etc...
- repeated MsgName msgNames = 7; // `autogenpb:unique` // in this file
+ repeated MsgName msgNames = 9; // `autogenpb:unique` // in this file
}
// I know, I know, the whole point of using protobuf
@@ -92,8 +57,8 @@ message File { // `autogenpb:nomarshal`
// also, this could be used to modify /usr/bin/file /usr/share/magic to identify the files
// maybe this is already been done and is pointless, but it seems like a good idea
message Files { // `autogenpb:marshal`
- string uuid = 1; // if you use this scheme, autogen will be able to identify your
- int64 version = 2; // protobuf files from the command line.
+ string uuid = 1; // `autogenpb:uuid:6c9ae4dd-648d-4b51-9738-bd59fb8fafd5`
+ string version = 2; // `autogenpb:version:v0.0.38`
repeated File Files = 3; // an array of each .proto file in the working directory
}