internal

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnumType_name = map[int32]string{
		0: "TEST",
		1: "ANOTHER",
	}
	EnumType_value = map[string]int32{
		"TEST":    0,
		"ANOTHER": 1,
	}
)

Enum value maps for EnumType.

View Source
var (
	TTime = reflect.TypeOf(time.Time{})

	TProtoMessage = reflect.TypeOf((*protoreflect.ProtoMessage)(nil)).Elem()
	TProtoMap     = reflect.TypeOf((*protoreflect.Map)(nil)).Elem()
	TProtoList    = reflect.TypeOf((*protoreflect.List)(nil)).Elem()
	TProtoEnum    = reflect.TypeOf((*protoreflect.Enum)(nil)).Elem()

	TProtoDuration = reflect.TypeOf(&durationpb.Duration{})

	TProtoEmpty     = reflect.TypeOf(&emptypb.Empty{})
	TProtoTimestamp = reflect.TypeOf(&timestamppb.Timestamp{})

	TProtoStruct          = reflect.TypeOf(&structpb.Struct{})
	TProtoStructValue     = reflect.TypeOf(&structpb.Value{})
	TProtoStructListValue = reflect.TypeOf(&structpb.ListValue{})

	TProtoWrappedString = reflect.TypeOf(&wrapperspb.StringValue{})
	TProtoWrappedBytes  = reflect.TypeOf(&wrapperspb.BytesValue{})
	TProtoWrappedBool   = reflect.TypeOf(&wrapperspb.BoolValue{})
	TProtoWrappedUInt32 = reflect.TypeOf(&wrapperspb.UInt32Value{})
	TProtoWrappedInt32  = reflect.TypeOf(&wrapperspb.Int32Value{})
	TProtoWrappedUInt64 = reflect.TypeOf(&wrapperspb.UInt64Value{})
	TProtoWrappedInt64  = reflect.TypeOf(&wrapperspb.Int64Value{})
	TProtoWrappedFloat  = reflect.TypeOf(&wrapperspb.FloatValue{})
	TProtoWrappedDouble = reflect.TypeOf(&wrapperspb.DoubleValue{})
)
View Source
var ErrDirectSet = errors.New("field should be accessed directly")

Functions

func GetRWValue

func GetRWValue(
	rv protoreflect.Value,
	protoMsg protoreflect.ProtoMessage,
	name string,
) (reflect.Value, error)

func NewDecodeError

func NewDecodeError(key string, original error) error

func PrepareInterfaceForDecode

func PrepareInterfaceForDecode(where string, val reflect.Value, t reflect.Type) (reflect.Value, error)

func PrepareInterfaceForEncode

func PrepareInterfaceForEncode(where string, val reflect.Value, t reflect.Type) (reflect.Value, error)

func PrepareValueForDecode

func PrepareValueForDecode(where string, val reflect.Value, t reflect.Type) (reflect.Value, error)

func PrepareValueForEncode

func PrepareValueForEncode(where string, val reflect.Value, t reflect.Type) (reflect.Value, error)

func ReflectIntoStd

func ReflectIntoStd(sfv protoreflect.Value, useEnumNumbers bool) reflect.Type

func ReflectToProtoValue

func ReflectToProtoValue(
	field reflect.Value,
) (protoreflect.Value, error)

Types

type DecodeError

type DecodeError struct {
	// contains filtered or unexported fields
}

DecodeError represents an error that occurs when unmarshalling BSON bytes into a native Go type.

func (*DecodeError) Error

func (de *DecodeError) Error() string

Error implements the error interface.

func (*DecodeError) Keys

func (de *DecodeError) Keys() []string

Keys returns the BSON key path that caused an error as a slice of strings. The keys in the slice are in top-down order. For example, if the document being unmarshalled was {a: {b: {c: 1}}} and the value for c was supposed to be a string, the keys slice will be ["a", "b", "c"].

func (*DecodeError) Unwrap

func (de *DecodeError) Unwrap() error

Unwrap returns the underlying error

type Embed

type Embed struct {
	Text string `protobuf:"bytes,2,opt,name=Text,proto3" json:"Text,omitempty"`
	// contains filtered or unexported fields
}

func (*Embed) Descriptor deprecated

func (*Embed) Descriptor() ([]byte, []int)

Deprecated: Use Embed.ProtoReflect.Descriptor instead.

func (*Embed) GetText

func (x *Embed) GetText() string

func (*Embed) ProtoMessage

func (*Embed) ProtoMessage()

func (*Embed) ProtoReflect

func (x *Embed) ProtoReflect() protoreflect.Message

func (*Embed) Reset

func (x *Embed) Reset()

func (*Embed) String

func (x *Embed) String() string

type EnumType

type EnumType int32
const (
	EnumType_TEST    EnumType = 0
	EnumType_ANOTHER EnumType = 1
)

func (EnumType) Descriptor

func (EnumType) Descriptor() protoreflect.EnumDescriptor

func (EnumType) Enum

func (x EnumType) Enum() *EnumType

func (EnumType) EnumDescriptor deprecated

func (EnumType) EnumDescriptor() ([]byte, []int)

Deprecated: Use EnumType.Descriptor instead.

func (EnumType) Number

func (x EnumType) Number() protoreflect.EnumNumber

func (EnumType) String

func (x EnumType) String() string

func (EnumType) Type

type Msg

type Msg struct {
	Field *Embed `protobuf:"bytes,1,opt,name=Field,proto3" json:"Field,omitempty"`
	// Types that are assignable to Variant:
	//	*Msg_A
	//	*Msg_B
	//	*Msg_C
	Variant  isMsg_Variant       `protobuf_oneof:"Variant"`
	MapField map[string]*Embed   `` /* 158-byte string literal not displayed */
	RepField []*Embed            `protobuf:"bytes,20,rep,name=RepField,proto3" json:"RepField,omitempty"`
	En       EnumType            `protobuf:"varint,25,opt,name=En,proto3,enum=test.EnumType" json:"En,omitempty"`
	RepEnum  []EnumType          `protobuf:"varint,30,rep,packed,name=RepEnum,proto3,enum=test.EnumType" json:"RepEnum,omitempty"`
	MapEnum  map[uint32]EnumType `` /* 177-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Msg) Descriptor deprecated

func (*Msg) Descriptor() ([]byte, []int)

Deprecated: Use Msg.ProtoReflect.Descriptor instead.

func (*Msg) GetA

func (x *Msg) GetA() string

func (*Msg) GetB

func (x *Msg) GetB() string

func (*Msg) GetC

func (x *Msg) GetC() *Embed

func (*Msg) GetEn

func (x *Msg) GetEn() EnumType

func (*Msg) GetField

func (x *Msg) GetField() *Embed

func (*Msg) GetMapEnum

func (x *Msg) GetMapEnum() map[uint32]EnumType

func (*Msg) GetMapField

func (x *Msg) GetMapField() map[string]*Embed

func (*Msg) GetRepEnum

func (x *Msg) GetRepEnum() []EnumType

func (*Msg) GetRepField

func (x *Msg) GetRepField() []*Embed

func (*Msg) GetVariant

func (m *Msg) GetVariant() isMsg_Variant

func (*Msg) ProtoMessage

func (*Msg) ProtoMessage()

func (*Msg) ProtoReflect

func (x *Msg) ProtoReflect() protoreflect.Message

func (*Msg) Reset

func (x *Msg) Reset()

func (*Msg) String

func (x *Msg) String() string

type Msg_A

type Msg_A struct {
	A string `protobuf:"bytes,2,opt,name=A,proto3,oneof"`
}

type Msg_B

type Msg_B struct {
	B string `protobuf:"bytes,3,opt,name=B,proto3,oneof"`
}

type Msg_C

type Msg_C struct {
	C *Embed `protobuf:"bytes,4,opt,name=C,proto3,oneof"`
}

type WKT

type WKT struct {
	EmptyField        *emptypb.Empty            `protobuf:"bytes,1,opt,name=EmptyField,proto3" json:"EmptyField,omitempty"`
	RepEmptyField     []*emptypb.Empty          `protobuf:"bytes,2,rep,name=RepEmptyField,proto3" json:"RepEmptyField,omitempty"`
	DurationField     *durationpb.Duration      `protobuf:"bytes,3,opt,name=DurationField,proto3" json:"DurationField,omitempty"`
	RepDurationField  []*durationpb.Duration    `protobuf:"bytes,4,rep,name=RepDurationField,proto3" json:"RepDurationField,omitempty"`
	TimestampField    *timestamppb.Timestamp    `protobuf:"bytes,5,opt,name=TimestampField,proto3" json:"TimestampField,omitempty"`
	RepTimestampField []*timestamppb.Timestamp  `protobuf:"bytes,6,rep,name=RepTimestampField,proto3" json:"RepTimestampField,omitempty"`
	StructField       *structpb.Struct          `protobuf:"bytes,7,opt,name=StructField,proto3" json:"StructField,omitempty"`
	RepStructField    []*structpb.Struct        `protobuf:"bytes,8,rep,name=RepStructField,proto3" json:"RepStructField,omitempty"`
	ValueField        *structpb.Value           `protobuf:"bytes,9,opt,name=ValueField,proto3" json:"ValueField,omitempty"`
	RepValueField     []*structpb.Value         `protobuf:"bytes,10,rep,name=RepValueField,proto3" json:"RepValueField,omitempty"`
	BoolField         *wrapperspb.BoolValue     `protobuf:"bytes,11,opt,name=BoolField,proto3" json:"BoolField,omitempty"`
	RepBoolField      []*wrapperspb.BoolValue   `protobuf:"bytes,12,rep,name=RepBoolField,proto3" json:"RepBoolField,omitempty"`
	BytesField        *wrapperspb.BytesValue    `protobuf:"bytes,13,opt,name=BytesField,proto3" json:"BytesField,omitempty"`
	RepBytesField     []*wrapperspb.BytesValue  `protobuf:"bytes,14,rep,name=RepBytesField,proto3" json:"RepBytesField,omitempty"`
	StringField       *wrapperspb.StringValue   `protobuf:"bytes,15,opt,name=StringField,proto3" json:"StringField,omitempty"`
	RepStringField    []*wrapperspb.StringValue `protobuf:"bytes,16,rep,name=RepStringField,proto3" json:"RepStringField,omitempty"`
	Int32Field        *wrapperspb.Int32Value    `protobuf:"bytes,17,opt,name=Int32Field,proto3" json:"Int32Field,omitempty"`
	RepInt32Field     []*wrapperspb.Int32Value  `protobuf:"bytes,18,rep,name=RepInt32Field,proto3" json:"RepInt32Field,omitempty"`
	Int64Field        *wrapperspb.Int64Value    `protobuf:"bytes,19,opt,name=Int64Field,proto3" json:"Int64Field,omitempty"`
	RepInt64Field     []*wrapperspb.Int64Value  `protobuf:"bytes,20,rep,name=RepInt64Field,proto3" json:"RepInt64Field,omitempty"`
	UInt32Field       *wrapperspb.UInt32Value   `protobuf:"bytes,21,opt,name=UInt32Field,proto3" json:"UInt32Field,omitempty"`
	RepUInt32Field    []*wrapperspb.UInt32Value `protobuf:"bytes,22,rep,name=RepUInt32Field,proto3" json:"RepUInt32Field,omitempty"`
	UInt64Field       *wrapperspb.UInt64Value   `protobuf:"bytes,23,opt,name=UInt64Field,proto3" json:"UInt64Field,omitempty"`
	RepUInt64Field    []*wrapperspb.UInt64Value `protobuf:"bytes,24,rep,name=RepUInt64Field,proto3" json:"RepUInt64Field,omitempty"`
	FloatField        *wrapperspb.FloatValue    `protobuf:"bytes,25,opt,name=FloatField,proto3" json:"FloatField,omitempty"`
	RepFloatField     []*wrapperspb.FloatValue  `protobuf:"bytes,26,rep,name=RepFloatField,proto3" json:"RepFloatField,omitempty"`
	DoubleField       *wrapperspb.DoubleValue   `protobuf:"bytes,27,opt,name=DoubleField,proto3" json:"DoubleField,omitempty"`
	RepDoubleField    []*wrapperspb.DoubleValue `protobuf:"bytes,28,rep,name=RepDoubleField,proto3" json:"RepDoubleField,omitempty"`
	// contains filtered or unexported fields
}

func (*WKT) Descriptor deprecated

func (*WKT) Descriptor() ([]byte, []int)

Deprecated: Use WKT.ProtoReflect.Descriptor instead.

func (*WKT) GetBoolField

func (x *WKT) GetBoolField() *wrapperspb.BoolValue

func (*WKT) GetBytesField

func (x *WKT) GetBytesField() *wrapperspb.BytesValue

func (*WKT) GetDoubleField

func (x *WKT) GetDoubleField() *wrapperspb.DoubleValue

func (*WKT) GetDurationField

func (x *WKT) GetDurationField() *durationpb.Duration

func (*WKT) GetEmptyField

func (x *WKT) GetEmptyField() *emptypb.Empty

func (*WKT) GetFloatField

func (x *WKT) GetFloatField() *wrapperspb.FloatValue

func (*WKT) GetInt32Field

func (x *WKT) GetInt32Field() *wrapperspb.Int32Value

func (*WKT) GetInt64Field

func (x *WKT) GetInt64Field() *wrapperspb.Int64Value

func (*WKT) GetRepBoolField

func (x *WKT) GetRepBoolField() []*wrapperspb.BoolValue

func (*WKT) GetRepBytesField

func (x *WKT) GetRepBytesField() []*wrapperspb.BytesValue

func (*WKT) GetRepDoubleField

func (x *WKT) GetRepDoubleField() []*wrapperspb.DoubleValue

func (*WKT) GetRepDurationField

func (x *WKT) GetRepDurationField() []*durationpb.Duration

func (*WKT) GetRepEmptyField

func (x *WKT) GetRepEmptyField() []*emptypb.Empty

func (*WKT) GetRepFloatField

func (x *WKT) GetRepFloatField() []*wrapperspb.FloatValue

func (*WKT) GetRepInt32Field

func (x *WKT) GetRepInt32Field() []*wrapperspb.Int32Value

func (*WKT) GetRepInt64Field

func (x *WKT) GetRepInt64Field() []*wrapperspb.Int64Value

func (*WKT) GetRepStringField

func (x *WKT) GetRepStringField() []*wrapperspb.StringValue

func (*WKT) GetRepStructField

func (x *WKT) GetRepStructField() []*structpb.Struct

func (*WKT) GetRepTimestampField

func (x *WKT) GetRepTimestampField() []*timestamppb.Timestamp

func (*WKT) GetRepUInt32Field

func (x *WKT) GetRepUInt32Field() []*wrapperspb.UInt32Value

func (*WKT) GetRepUInt64Field

func (x *WKT) GetRepUInt64Field() []*wrapperspb.UInt64Value

func (*WKT) GetRepValueField

func (x *WKT) GetRepValueField() []*structpb.Value

func (*WKT) GetStringField

func (x *WKT) GetStringField() *wrapperspb.StringValue

func (*WKT) GetStructField

func (x *WKT) GetStructField() *structpb.Struct

func (*WKT) GetTimestampField

func (x *WKT) GetTimestampField() *timestamppb.Timestamp

func (*WKT) GetUInt32Field

func (x *WKT) GetUInt32Field() *wrapperspb.UInt32Value

func (*WKT) GetUInt64Field

func (x *WKT) GetUInt64Field() *wrapperspb.UInt64Value

func (*WKT) GetValueField

func (x *WKT) GetValueField() *structpb.Value

func (*WKT) ProtoMessage

func (*WKT) ProtoMessage()

func (*WKT) ProtoReflect

func (x *WKT) ProtoReflect() protoreflect.Message

func (*WKT) Reset

func (x *WKT) Reset()

func (*WKT) String

func (x *WKT) String() string

Jump to

Keyboard shortcuts

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