contrib
contrib copied to clipboard
entproto: Add proto3 optional label support
proto3 supports using optional fields to define optional fields, so google/protobuf/wrappers.proto does not need to be used. This will make the generated code more concise.
The EnableOptionLabel can enable this feature for a specific Message individually.
// EnableOptionalLabel enables the optional label in the generated protobuf message instead of google/protobuf/wrappers.proto
func EnableOptionalLabel() MessageOption {
return func(msg *message) {
msg.EnableOptionalLabel = true
}
}