Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.1 KiB
68 lines
1.1 KiB
|
|
// A series of messages with various kinds of cycles in them. |
|
// +-+---+ +---+ +---+ |
|
// V | | V | V | |
|
// A -> B-+-> C -> D---+--->E---+ |
|
// ^ |`---|--------^ |
|
// +----------+----+ F |
|
|
|
syntax = "proto2"; |
|
|
|
message A { |
|
optional B b = 1; |
|
} |
|
|
|
message B { |
|
optional B b = 1; |
|
optional C c = 2; |
|
} |
|
|
|
message C { |
|
optional A a = 1; |
|
optional B b = 2; |
|
optional D d = 3; |
|
optional E e = 4; |
|
} |
|
|
|
message D { |
|
optional A a = 1; |
|
optional D d = 2; |
|
optional E e = 3; |
|
} |
|
|
|
message E { |
|
optional E e = 1; |
|
} |
|
|
|
message F { |
|
optional E e = 1; |
|
} |
|
|
|
// A proto with a bunch of simple primitives. |
|
message SimplePrimitives { |
|
optional fixed64 u64 = 1; |
|
optional fixed32 u32 = 2; |
|
optional double dbl = 3; |
|
optional float flt = 5; |
|
optional sint64 i64 = 6; |
|
optional sint32 i32 = 7; |
|
optional bool b = 8; |
|
optional string str = 9; |
|
|
|
oneof foo { |
|
int32 oneof_int32 = 10; |
|
string oneof_string = 11; |
|
} |
|
|
|
oneof bar { |
|
int64 oneof_int64 = 13; |
|
bytes oneof_bytes = 14; |
|
} |
|
|
|
message Nested { |
|
oneof foo { |
|
int32 oneof_int32 = 10; |
|
string b = 11; |
|
} |
|
} |
|
}
|
|
|