-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for (proto3) optional fields
Fixes #2
- Loading branch information
1 parent
c26800e
commit 5c68093
Showing
9 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# oneoftypes | ||
|
||
Example of all basic types using the `optional` field rule. | ||
|
||
This example was added as part of addressing [issue #2](https://github.com/joeycumines/protoc-gen-go-copy/issues/2). | ||
|
||
See [../README.md](../README.md) for how to generate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
syntax = "proto3"; | ||
|
||
package examples.optionalfields; | ||
|
||
option go_package = "github.com/joeycumines/protoc-gen-go-copy/examples/optionalfields"; | ||
|
||
message Example { | ||
message A { | ||
} | ||
enum B { | ||
B_UNSPECIFIED = 0; | ||
} | ||
|
||
// https://developers.google.com/protocol-buffers/docs/proto3#scalar | ||
|
||
optional double double = 1; | ||
optional float float = 2; | ||
optional int32 int32 = 3; | ||
optional int64 int64 = 4; | ||
optional uint32 uint32 = 5; | ||
optional uint64 uint64 = 6; | ||
optional sint32 sint32 = 7; | ||
optional sint64 sint64 = 8; | ||
optional fixed32 fixed32 = 9; | ||
optional fixed64 fixed64 = 10; | ||
optional sfixed32 sfixed32 = 11; | ||
optional sfixed64 sfixed64 = 12; | ||
optional bool bool = 13; | ||
optional string string = 14; | ||
optional bytes bytes = 15; | ||
|
||
optional A message = 21; | ||
optional B enum = 22; | ||
optional Example recursive = 23; | ||
|
||
string non_optional = 31; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters