Documentation ¶
Index ¶
- Variables
- func CheckMapDuplicateKey(dst, src proto.Message) error
- func EqualMessage(v1, v2 pref.Value) bool
- func EqualValue(fd pref.FieldDescriptor, v1, v2 pref.Value) bool
- func Merge(dst, src proto.Message) error
- func NewFiles(protoPaths []string, protoFiles []string, excludeProtoFiles ...string) (*protoregistry.Files, error)
- func ParseFieldValue(fd pref.FieldDescriptor, rawValue string, locationName string) (v pref.Value, present bool, err error)
- func ParseProtos(protoPaths []string, protoFiles ...string) (*protoregistry.Files, error)
- type EnumCache
- type TypeInfo
- type TypeInfos
Constants ¶
This section is empty.
Variables ¶
var DefaultBoolValue pref.Value
var DefaultBytesValue pref.Value
var DefaultDurationValue pref.Value
var DefaultEnumValue pref.Value
var DefaultFloat32Value pref.Value
var DefaultFloat64Value pref.Value
var DefaultInt32Value pref.Value
var DefaultInt64Value pref.Value
var DefaultStringValue pref.Value
var DefaultTimestampValue pref.Value
var DefaultUint32Value pref.Value
var DefaultUint64Value pref.Value
var ErrDuplicateKey = errors.New("duplicate key")
var WellKnownMessages = map[string]int{
"google.protobuf.Timestamp": 1,
"google.protobuf.Duration": 1,
}
Functions ¶
func CheckMapDuplicateKey ¶ added in v0.10.7
CheckMapDuplicateKey checks the map field's duplicate key in message with the same descriptor.
func EqualMessage ¶ added in v0.9.17
EqualMessage reports whether two messages are equal.
func EqualValue ¶ added in v0.9.17
func EqualValue(fd pref.FieldDescriptor, v1, v2 pref.Value) bool
EqualValue compares two singular values. NOTE(wenchy): borrowed from https://github.com/protocolbuffers/protobuf-go/blob/v1.27.1/proto/equal.go#L113
func Merge ¶ added in v0.10.7
Merge merges src into dst, which must be a message with the same descriptor.
NOTE: message should only has two kinds of field:
- list
- map: src should not has duplicate key in dst
func NewFiles ¶ added in v0.9.14
func NewFiles(protoPaths []string, protoFiles []string, excludeProtoFiles ...string) (*protoregistry.Files, error)
NewFiles creates a new protoregistry.Files from the proto paths and proto Gob filenames.
func ParseFieldValue ¶ added in v0.9.17
func ParseProtos ¶
func ParseProtos(protoPaths []string, protoFiles ...string) (*protoregistry.Files, error)
ParseProtos parses the proto paths and proto files to desc.FileDescriptor slices.
Types ¶
type EnumCache ¶ added in v0.10.7
func (*EnumCache) GetValueByAlias ¶ added in v0.10.7
type TypeInfos ¶ added in v0.10.7
type TypeInfos struct {
// contains filtered or unexported fields
}
func GetAllTypeInfo ¶ added in v0.9.17
func GetAllTypeInfo(files *protoregistry.Files, protoPackage string) *TypeInfos
func NewTypeInfos ¶ added in v0.10.7
func (*TypeInfos) Get ¶ added in v0.10.7
Get retrieves type info by name in proto package. It will auto prepend proto package to inputed name to generate the full name of type.