|
| 1 | +# Protocol Documentation |
| 2 | +<a name="top"></a> |
| 3 | + |
| 4 | +## Table of Contents |
| 5 | + |
| 6 | +- [patch/go.proto](#patch_go-proto) |
| 7 | + - [LintOptions](#go-LintOptions) |
| 8 | + - [Options](#go-Options) |
| 9 | + |
| 10 | + - [File-level Extensions](#patch_go-proto-extensions) |
| 11 | + - [File-level Extensions](#patch_go-proto-extensions) |
| 12 | + - [File-level Extensions](#patch_go-proto-extensions) |
| 13 | + - [File-level Extensions](#patch_go-proto-extensions) |
| 14 | + - [File-level Extensions](#patch_go-proto-extensions) |
| 15 | + - [File-level Extensions](#patch_go-proto-extensions) |
| 16 | + |
| 17 | +- [Scalar Value Types](#scalar-value-types) |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +<a name="patch_go-proto"></a> |
| 22 | +<p align="right"><a href="#top">Top</a></p> |
| 23 | + |
| 24 | +## patch/go.proto |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +<a name="go-LintOptions"></a> |
| 29 | + |
| 30 | +### LintOptions |
| 31 | +LintOptions represent options for linting a generated Go file. |
| 32 | + |
| 33 | + |
| 34 | +| Field | Type | Label | Description | |
| 35 | +| ----- | ---- | ----- | ----------- | |
| 36 | +| all | [bool](#bool) | optional | Set all to true if all generated Go symbols should be linted. This option affects generated structs, struct fields, enum types, and value constants. | |
| 37 | +| messages | [bool](#bool) | optional | Set messages to true if message names should be linted. This does not affect message fields. | |
| 38 | +| fields | [bool](#bool) | optional | Set messages to true if message field names should be linted. This does not affect message fields. | |
| 39 | +| enums | [bool](#bool) | optional | Set enums to true if generated enum names should be linted. This does not affect enum values. | |
| 40 | +| values | [bool](#bool) | optional | Set values to true if generated enum value constants should be linted. | |
| 41 | +| extensions | [bool](#bool) | optional | Set extensions to true if generated extension names should be linted. | |
| 42 | +| initialisms | [string](#string) | repeated | The initialisms option lets you specify strings that should not be generated as mixed-case, Examples: ID, URL, HTTP, etc. | |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +<a name="go-Options"></a> |
| 50 | + |
| 51 | +### Options |
| 52 | +Options represent Go-specific options for Protobuf messages, fields, oneofs, enums, or enum values. |
| 53 | + |
| 54 | + |
| 55 | +| Field | Type | Label | Description | |
| 56 | +| ----- | ---- | ----- | ----------- | |
| 57 | +| name | [string](#string) | optional | The name option renames the generated Go identifier and related identifiers. For a message, this renames the generated Go struct and nested messages or enums, if any. For a message field, this renames the generated Go struct field and getter method. For a oneof field, this renames the generated Go struct field, getter method, interface type, and wrapper types. For an enum, this renames the generated Go type. For an enum value, this renames the generated Go const. | |
| 58 | +| embed | [bool](#bool) | optional | The embed option indicates the field should be embedded in the generated Go struct. Only message types can be embedded. Oneof fields cannot be embedded. See https://golang.org/ref/spec#Struct_types. | |
| 59 | +| type | [string](#string) | optional | The type option changes the generated field type. All generated code assumes that this type is castable to the protocol buffer field type. | |
| 60 | +| getter | [string](#string) | optional | The getter option renames the generated getter method (default: Get<Field>) so a custom getter can be implemented in its place. |
| 61 | + |
| 62 | +TODO: implement this | |
| 63 | +| tags | [string](#string) | optional | The tags option specifies additional struct tags which are appended a generated Go struct field. This option may be specified on a message field or a oneof field. The value should omit the enclosing backticks. | |
| 64 | +| stringer | [string](#string) | optional | The stringer option renames a generated String() method (if any) so a custom String() method can be implemented in its place. |
| 65 | + |
| 66 | +TODO: implement for messages | |
| 67 | +| stringer_name | [string](#string) | optional | The stringer_name option is a deprecated alias for stringer. It will be removed in a future version of this package. | |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +<a name="patch_go-proto-extensions"></a> |
| 79 | + |
| 80 | +### File-level Extensions |
| 81 | +| Extension | Type | Base | Number | Description | |
| 82 | +| --------- | ---- | ---- | ------ | ----------- | |
| 83 | +| enum | Options | .google.protobuf.EnumOptions | 7001 | | |
| 84 | +| value | Options | .google.protobuf.EnumValueOptions | 7001 | | |
| 85 | +| field | Options | .google.protobuf.FieldOptions | 7001 | | |
| 86 | +| lint | LintOptions | .google.protobuf.FileOptions | 7001 | | |
| 87 | +| message | Options | .google.protobuf.MessageOptions | 7001 | | |
| 88 | +| oneof | Options | .google.protobuf.OneofOptions | 7001 | | |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | +## Scalar Value Types |
| 97 | + |
| 98 | +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | |
| 99 | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | |
| 100 | +| <a name="double" /> double | | double | double | float | float64 | double | float | Float | |
| 101 | +| <a name="float" /> float | | float | float | float | float32 | float | float | Float | |
| 102 | +| <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | |
| 103 | +| <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | |
| 104 | +| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | |
| 105 | +| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | |
| 106 | +| <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | |
| 107 | +| <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | |
| 108 | +| <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | |
| 109 | +| <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | |
| 110 | +| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | |
| 111 | +| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | |
| 112 | +| <a name="bool" /> bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | |
| 113 | +| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | |
| 114 | +| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | |
| 115 | + |
0 commit comments