Documentation
¶
Index ¶
- Constants
- func GetProtobufTag(structField reflect.StructField, fieldName string) (string, error)
- func GetProtobufTagName(protobufTag, fieldName string) (string, error)
- func IsProtobufFieldOptional(protobufTag string) bool
- func IsProtobufGeneratedField(fieldName string) bool
- func IsProtobufOneOfField(structField reflect.StructField) bool
Constants ¶
const ( ProtobufTag = "protobuf" ProtobufOneOf = "oneof" ProtobufOneOfTag = "protobuf_oneof" ProtobufNamePrefix = "name=" )
const ( State = "state" SizeCache = "sizeCache" UnknownFields = "unknownFields" )
const ( ErrProtobufTagNotFound = "missing protobuf tag for field: %s" ErrProtobufTagNameNotFound = "missing protobuf tag name for field: %s" )
Variables ¶
This section is empty.
Functions ¶
func GetProtobufTag ¶
func GetProtobufTag(structField reflect.StructField, fieldName string) (string, error)
GetProtobufTag gets the Protobuf tag number for a given struct field name
Parameters:
- structField: The struct field - fieldName: The name of the struct field
Returns:
- string: Protobuf tag - error: error if the Protobuf tag is not found
func GetProtobufTagName ¶
GetProtobufTagName returns the Protobuf tag name for a given struct field name
Parameters:
- protobufTag: The Protobuf tag of the struct field
- fieldName: The name of the struct field
Returns:
- string: Protobuf tag name
func IsProtobufFieldOptional ¶
IsProtobufFieldOptional returns true if the Protobuf field is optional
Parameters:
- protobufTag: The Protobuf tag of the struct field
Returns:
- bool: true if the Protobuf field is optional
func IsProtobufGeneratedField ¶
IsProtobufGeneratedField checks if the field is a Protobuf generated field
Parameters:
- fieldName: The name of the struct field
Returns:
- bool: true if the field is a Protobuf generated field
func IsProtobufOneOfField ¶
func IsProtobufOneOfField(structField reflect.StructField) bool
IsProtobufOneOfField checks if the struct field is a Protobuf oneof field
Parameters:
- structField: The struct field
Returns:
- bool: true if the struct field is a Protobuf oneof field
Types ¶
This section is empty.