nekoray_Mahdi-zarei/3rdparty/simple-protobuf/test/proto/message.proto
parhelia512 daa6c93900
refactor: migrate from protobuf to simple-protobuf (#520)
* refactor: migrate from protobuf to simple-protobuf

* update go.mod

* fix server

* Update gRPC.cpp

* Update gRPC.cpp
2025-07-12 15:17:05 -07:00

46 lines
1.5 KiB
Protocol Buffer

// Specify whether you're using proto2 or proto3 at the top of the file
syntax = "proto2";
/***********/
// PACKAGE //
/***********/
// Your message will be packaged under "tutorial" now
// It's good practice to use packages to prevent naming conflicts
// between different projects. Fittingly, in C++ our generated
// classes will be placed in a namespace of the same name ("tutorial")
package tutorial;
message Person {
// REQUIRED V.S. OPTIONAL FIELDS
// Be careful about setting fields as required; it can be a headache
// if the fields end up becoming optional later on. Some developers
// just stick to making all fields optional no matter what.
required string name = 1;
required int32 id = 2;
optional string email = 3;
// ENUMS
// It's good practice to define enums if you have fields with a
// fixed set of values they could possibly take. Much more readable
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
// NESTED MESSAGE DEFINITIONS
// You can define messages within other message definitions
message PhoneNumber {
message PhoneNumber2 {
required string number = 1;
optional PhoneType type = 2 [ default = HOME ];
}
required string number = 1;
optional PhoneType type = 2 [ default = HOME ];
}
// REPEATED FIELDS
// The repeated keyword allows us to have multiple numbers
repeated PhoneNumber phones = 4;
}