xproto

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBoolValue pref.Value
View Source
var DefaultBytesValue pref.Value
View Source
var DefaultDurationValue pref.Value
View Source
var DefaultEnumValue pref.Value
View Source
var DefaultFloat32Value pref.Value
View Source
var DefaultFloat64Value pref.Value
View Source
var DefaultInt32Value pref.Value
View Source
var DefaultInt64Value pref.Value
View Source
var DefaultStringValue pref.Value
View Source
var DefaultTimestampValue pref.Value
View Source
var DefaultUint32Value pref.Value
View Source
var DefaultUint64Value pref.Value
View Source
var ErrDuplicateKey = errors.New("duplicate key")
View Source
var WellKnownMessages = map[string]int{
	"google.protobuf.Timestamp": 1,
	"google.protobuf.Duration":  1,
}

Functions

func CheckMapDuplicateKey added in v0.10.7

func CheckMapDuplicateKey(dst, src proto.Message) error

CheckMapDuplicateKey checks the map field's duplicate key in message with the same descriptor.

func EqualMessage added in v0.9.17

func EqualMessage(v1, v2 pref.Value) bool

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

func Merge(dst, src proto.Message) error

Merge merges src into dst, which must be a message with the same descriptor.

NOTE: message should only has two kinds of field:

  1. list
  2. 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 ParseFieldValue(fd pref.FieldDescriptor, rawValue string, locationName string) (v pref.Value, present bool, err error)

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

type EnumCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*EnumCache) GetValueByAlias added in v0.10.7

func (ec *EnumCache) GetValueByAlias(ed pref.EnumDescriptor, valueAlias string) (pref.Value, bool)

type TypeInfo added in v0.9.17

type TypeInfo struct {
	FullName       string
	ParentFilename string
	Kind           types.Kind
}

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 NewTypeInfos(protoPackage string) *TypeInfos

func (*TypeInfos) Get added in v0.10.7

func (x *TypeInfos) Get(name string) *TypeInfo

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.

func (*TypeInfos) GetByFullName added in v0.10.7

func (x *TypeInfos) GetByFullName(fullName string) *TypeInfo

func (*TypeInfos) Put added in v0.10.7

func (x *TypeInfos) Put(info *TypeInfo)

Jump to

Keyboard shortcuts

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