Skip to content

Instantly share code, notes, and snippets.

@jakobii
Created May 28, 2021 16:05
Show Gist options
  • Save jakobii/36f525a2f5d488f2b557a0dfbbc8277e to your computer and use it in GitHub Desktop.
Save jakobii/36f525a2f5d488f2b557a0dfbbc8277e to your computer and use it in GitHub Desktop.
Proto3 Optional Scalar Values
message Double {
oneof value {
None none = 1;
double some = 2;
}
}
message Float {
oneof value {
None none = 1;
float some = 2;
}
}
message Int32 {
oneof value {
None none = 1;
int32 some = 2;
}
}
message Int64 {
oneof value {
None none = 1;
int64 some = 2;
}
}
message Uint32 {
oneof value {
None none = 1;
uint32 some = 2;
}
}
message Uint64 {
oneof value {
None none = 1;
uint64 some = 2;
}
}
message Sint32 {
oneof value {
None none = 1;
sint32 some = 2;
}
}
message Sint64 {
oneof value {
None none = 1;
sint64 some = 2;
}
}
message Fixed32 {
oneof value {
None none = 1;
fixed32 some = 2;
}
}
message Fixed64 {
oneof value {
None none = 1;
fixed64 some = 2;
}
}
message Sfixed32 {
oneof value {
None none = 1;
sfixed32 some = 2;
}
}
message Sfixed64 {
oneof value {
None none = 1;
sfixed64 some = 2;
}
}
message Bool {
oneof value {
None none = 1;
bool some = 2;
}
}
message String {
oneof value {
None none = 1;
string some = 2;
}
}
message Bytes {
oneof value {
None none = 1;
bytes some = 2;
}
}
enum None {
none = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment