record

package
v0.0.0-...-85a7822 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFoundKeyPath    = errors.New("Not found key path")
	ErrNotSupportedMethod = errors.New("Not supported method")
)
View Source
var (
	NotUnsignedIntegerErr = errors.New("Not unisgned integer")
	NotIntegerErr         = errors.New("Not integer")
	NotFloatErr           = errors.New("Not float")
)
View Source
var (
	DataType_name = map[int32]string{
		0: "BOOLEAN",
		1: "BINARY",
		2: "STRING",
		3: "UINT64",
		4: "INT64",
		5: "FLOAT64",
		6: "ARRAY",
		7: "MAP",
		8: "NULL",
		9: "TIME",
	}
	DataType_value = map[string]int32{
		"BOOLEAN": 0,
		"BINARY":  1,
		"STRING":  2,
		"UINT64":  3,
		"INT64":   4,
		"FLOAT64": 5,
		"ARRAY":   6,
		"MAP":     7,
		"NULL":    8,
		"TIME":    9,
	}
)

Enum value maps for DataType.

View Source
var File_types_record_record_proto protoreflect.FileDescriptor
View Source
var (
	UnsupportedOperationErr = errors.New("Unsupported operation")
)

Functions

func ApplyChanges

func ApplyChanges(orig *Value, changes *Value)

func ConvertFieldsToMap

func ConvertFieldsToMap(fields []*Field) map[string]interface{}

func GetValueData

func GetValueData(value *Value) interface{}

func Marshal

func Marshal(record *Record) ([]byte, error)

func MarshalJSON

func MarshalJSON(record *Record) ([]byte, error)

func Merge

func Merge(origRecord *Record, updates *Record) []byte

func StrToBytes

func StrToBytes(s string) []byte

func Unmarshal

func Unmarshal(data []byte, record *Record) error

func UnmarshalJSON

func UnmarshalJSON(data []byte, record *Record) error

func UnmarshalMapData

func UnmarshalMapData(obj map[string]interface{}, record *Record) error

Types

type ArrayValue

type ArrayValue struct {
	Elements []*Value `protobuf:"bytes,1,rep,name=elements,proto3" json:"elements,omitempty"`
	// contains filtered or unexported fields
}

func (*ArrayValue) Descriptor deprecated

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

Deprecated: Use ArrayValue.ProtoReflect.Descriptor instead.

func (*ArrayValue) GetElements

func (x *ArrayValue) GetElements() []*Value

func (*ArrayValue) ProtoMessage

func (*ArrayValue) ProtoMessage()

func (*ArrayValue) ProtoReflect

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

func (*ArrayValue) Reset

func (x *ArrayValue) Reset()

func (*ArrayValue) String

func (x *ArrayValue) String() string

type DataType

type DataType int32
const (
	DataType_BOOLEAN DataType = 0
	DataType_BINARY  DataType = 1
	DataType_STRING  DataType = 2
	DataType_UINT64  DataType = 3
	DataType_INT64   DataType = 4
	DataType_FLOAT64 DataType = 5
	DataType_ARRAY   DataType = 6
	DataType_MAP     DataType = 7
	DataType_NULL    DataType = 8
	DataType_TIME    DataType = 9
)

func (DataType) Descriptor

func (DataType) Descriptor() protoreflect.EnumDescriptor

func (DataType) Enum

func (x DataType) Enum() *DataType

func (DataType) EnumDescriptor deprecated

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

Deprecated: Use DataType.Descriptor instead.

func (DataType) Number

func (x DataType) Number() protoreflect.EnumNumber

func (DataType) String

func (x DataType) String() string

func (DataType) Type

type Field

type Field struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Value *Value `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func GetField

func GetField(fields []*Field, fieldName string) *Field

func (*Field) Descriptor deprecated

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

Deprecated: Use Field.ProtoReflect.Descriptor instead.

func (*Field) GetName

func (x *Field) GetName() string

func (*Field) GetValue

func (x *Field) GetValue() *Value

func (*Field) ProtoMessage

func (*Field) ProtoMessage()

func (*Field) ProtoReflect

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

func (*Field) Reset

func (x *Field) Reset()

func (*Field) String

func (x *Field) String() string

type MapValue

type MapValue struct {
	Fields []*Field `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty"`
	// contains filtered or unexported fields
}

func (*MapValue) Descriptor deprecated

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

Deprecated: Use MapValue.ProtoReflect.Descriptor instead.

func (*MapValue) GetFields

func (x *MapValue) GetFields() []*Field

func (*MapValue) ProtoMessage

func (*MapValue) ProtoMessage()

func (*MapValue) ProtoReflect

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

func (*MapValue) Reset

func (x *MapValue) Reset()

func (*MapValue) String

func (x *MapValue) String() string

type Record

type Record struct {
	Meta    *structpb.Struct `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty"`
	Payload *Value           `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func NewRecord

func NewRecord() *Record

func (*Record) AsMap

func (record *Record) AsMap() map[string]interface{}

func (*Record) CalculateKey

func (record *Record) CalculateKey(fields []string) ([]byte, error)

func (*Record) Descriptor deprecated

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

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetMeta

func (x *Record) GetMeta() *structpb.Struct

func (*Record) GetPayload

func (x *Record) GetPayload() *Value

func (*Record) GetValueByPath

func (record *Record) GetValueByPath(key string) (*Value, error)

func (*Record) GetValueDataByPath

func (record *Record) GetValueDataByPath(key string) (interface{}, error)

func (*Record) ProtoMessage

func (*Record) ProtoMessage()

func (*Record) ProtoReflect

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

func (*Record) Reset

func (x *Record) Reset()

func (*Record) String

func (x *Record) String() string

type Value

type Value struct {
	Type      DataType               `protobuf:"varint,1,opt,name=type,proto3,enum=compton.types.record.DataType" json:"type,omitempty"`
	Value     []byte                 `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	Map       *MapValue              `protobuf:"bytes,3,opt,name=map,proto3" json:"map,omitempty"`
	Array     *ArrayValue            `protobuf:"bytes,4,opt,name=array,proto3" json:"array,omitempty"`
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func CreateValue

func CreateValue(t DataType, data interface{}) (*Value, error)

func GetValueByPath

func GetValueByPath(value *Value, key string) (*Value, error)

func GetValueFromInterface

func GetValueFromInterface(data interface{}) (*Value, error)

func (*Value) Descriptor deprecated

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

Deprecated: Use Value.ProtoReflect.Descriptor instead.

func (*Value) GetArray

func (x *Value) GetArray() *ArrayValue

func (*Value) GetBytes

func (v *Value) GetBytes() ([]byte, error)

func (*Value) GetData

func (v *Value) GetData() interface{}

func (*Value) GetMap

func (x *Value) GetMap() *MapValue

func (*Value) GetTimestamp

func (x *Value) GetTimestamp() *timestamppb.Timestamp

func (*Value) GetType

func (x *Value) GetType() DataType

func (*Value) GetValue

func (x *Value) GetValue() []byte

func (*Value) ProtoMessage

func (*Value) ProtoMessage()

func (*Value) ProtoReflect

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

func (*Value) Reset

func (x *Value) Reset()

func (*Value) String

func (x *Value) String() string

Jump to

Keyboard shortcuts

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