summaryrefslogtreecommitdiff
path: root/example/fruit.proto
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-09 12:54:04 -0600
committerJeff Carr <[email protected]>2025-01-09 12:54:04 -0600
commite79ba634661baba562fa0ab9245040bd37c29f4c (patch)
treea0f0908d87ff9197ebc87dd6a715e002b2a0785c /example/fruit.proto
parentc99d8763e6c85513c700d58cd1e2163c31d2187d (diff)
rename dir
Diffstat (limited to 'example/fruit.proto')
-rw-r--r--example/fruit.proto46
1 files changed, 46 insertions, 0 deletions
diff --git a/example/fruit.proto b/example/fruit.proto
new file mode 100644
index 0000000..821ae6c
--- /dev/null
+++ b/example/fruit.proto
@@ -0,0 +1,46 @@
+syntax = "proto3";
+
+// this file is called "fruit.proto"
+//
+// for autogenpb to work, you must have:
+//
+// "Fruit" must exist. you can put anything in it
+//
+// and
+//
+// "Fruits" MUST EXIST and start exactly this way
+// It must be "Fruit" + 's' and must match the name of this file: "fruit.proto"
+
+package fruit;
+
+import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
+
+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()
+ google.protobuf.Timestamp ctime = 3; // when the apple was born
+}
+
+message Pear {
+ string name = 1; //
+ string favorite = 2; // `autogenpb:sort`
+}
+
+// "Fruit" must exist. you can put anything in it
+message Fruit { // `autogenpb:marshal`
+ string brand = 1; // `autogenpb:unique`
+ repeated Apple apples = 2;
+ repeated Pear pears = 3;
+ string UPC = 4; // `autogenpb:sort` `autogenpb:unique`
+ string city = 5; // `autogenpb:sort`
+}
+
+// "Fruits" MUST EXIST and start exactly this way
+// It must be "Fruit" + 's' and must match the name of this file: "fruit.proto"
+message Fruits { // `autogenpb:marshal` `autogenpb:mutex`
+ string uuid = 1; // `autogenpb:uuid:be926ad9-f07f-484c-adf2-d96eeabf3079`
+ string version = 2; // `autogenpb:version:v0.0.1`
+ repeated Fruit Fruits = 3; // THIS MUST BE "Fruit" and then "Fruit" + "s"
+ // you can add additional things here but the three lines above must conform to the standard above
+ int64 cost = 4;
+}