protobuf

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2025 License: GPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProtobufTag        = "protobuf"
	ProtobufOneOf      = "oneof"
	ProtobufOneOfTag   = "protobuf_oneof"
	ProtobufNamePrefix = "name="
)
View Source
const (
	State         = "state"
	SizeCache     = "sizeCache"
	UnknownFields = "unknownFields"
)
View Source
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

func GetProtobufTagName(protobufTag, fieldName string) (string, error)

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

func IsProtobufFieldOptional(protobufTag string) bool

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

func IsProtobufGeneratedField(fieldName string) bool

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, error)

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 - error: error if the struct field is nil

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL