record

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 20 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotFoundPrimaryKey    = errors.New("Not found primary key")
	NotUnsignedIntegerErr = errors.New("Not unisgned integer")
	NotIntegerErr         = errors.New("Not integer")
	NotFloatErr           = errors.New("Not float")
)
View Source
var (
	Method_name = map[int32]string{
		0: "INSERT",
		1: "UPDATE",
		2: "DELETE",
		3: "TRUNCATE",
	}
	Method_value = map[string]int32{
		"INSERT":   0,
		"UPDATE":   1,
		"DELETE":   2,
		"TRUNCATE": 3,
	}
)

Enum value maps for Method.

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 ConvertFieldsToMap added in v0.0.49

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

func GetValue

func GetValue(value *Value) interface{}

func Marshal added in v0.0.47

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

func StrToBytes added in v0.0.13

func StrToBytes(s string) []byte

func Unmarshal added in v0.0.47

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

func UnmarshalJSON added in v0.0.13

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

func UnmarshalMapData added in v0.0.13

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 added in v0.0.30

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

func (*ArrayValue) Reset

func (x *ArrayValue) Reset()

func (*ArrayValue) String

func (x *ArrayValue) String() string

type ColumnDef

type ColumnDef struct {
	ColumnName  string
	BindingName string
	Value       interface{}
}

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 added in v0.0.30

func (DataType) Descriptor() protoreflect.EnumDescriptor

func (DataType) Enum added in v0.0.30

func (x DataType) Enum() *DataType

func (DataType) EnumDescriptor deprecated

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

Deprecated: Use DataType.Descriptor instead.

func (DataType) Number added in v0.0.30

func (x DataType) Number() protoreflect.EnumNumber

func (DataType) String

func (x DataType) String() string

func (DataType) Type added in v0.0.30

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 added in v0.0.47

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 added in v0.0.30

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 added in v0.0.30

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

func (*MapValue) Reset

func (x *MapValue) Reset()

func (*MapValue) String

func (x *MapValue) String() string

type Method

type Method int32
const (
	Method_INSERT   Method = 0
	Method_UPDATE   Method = 1
	Method_DELETE   Method = 2
	Method_TRUNCATE Method = 3
)

func (Method) Descriptor added in v0.0.30

func (Method) Descriptor() protoreflect.EnumDescriptor

func (Method) Enum added in v0.0.30

func (x Method) Enum() *Method

func (Method) EnumDescriptor deprecated

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

Deprecated: Use Method.Descriptor instead.

func (Method) Number added in v0.0.30

func (x Method) Number() protoreflect.EnumNumber

func (Method) String

func (x Method) String() string

func (Method) Type added in v0.0.30

func (Method) Type() protoreflect.EnumType

type Record

type Record struct {
	EventName  string   `protobuf:"bytes,1,opt,name=eventName,proto3" json:"eventName,omitempty"`
	Table      string   `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"`
	Method     Method   `protobuf:"varint,3,opt,name=method,proto3,enum=gravity.sdk.types.record.Method" json:"method,omitempty"`
	PrimaryKey string   `protobuf:"bytes,4,opt,name=primaryKey,proto3" json:"primaryKey,omitempty"`
	Fields     []*Field `protobuf:"bytes,5,rep,name=fields,proto3" json:"fields,omitempty"`
	// contains filtered or unexported fields
}

func (*Record) Descriptor deprecated

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

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetEventName

func (x *Record) GetEventName() string

func (*Record) GetFields

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

func (*Record) GetMethod

func (x *Record) GetMethod() Method

func (*Record) GetPayload added in v0.0.47

func (record *Record) GetPayload() *Value

func (*Record) GetPrimaryKey

func (x *Record) GetPrimaryKey() string

func (*Record) GetPrimaryKeyValue added in v0.0.47

func (record *Record) GetPrimaryKeyValue() (*Value, error)

func (*Record) GetTable

func (x *Record) GetTable() string

func (*Record) ProtoMessage

func (*Record) ProtoMessage()

func (*Record) ProtoReflect added in v0.0.30

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

func (*Record) Reset

func (x *Record) Reset()

func (*Record) String

func (x *Record) String() string

type RecordDef

type RecordDef struct {
	HasPrimary    bool
	PrimaryColumn string
	Values        map[string]interface{}
	ColumnDefs    []*ColumnDef
}

func GetDefinition

func GetDefinition(record *Record) (*RecordDef, error)

type SendReply

type SendReply struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	Reason  string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
	// contains filtered or unexported fields
}

func (*SendReply) Descriptor deprecated

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

Deprecated: Use SendReply.ProtoReflect.Descriptor instead.

func (*SendReply) GetReason

func (x *SendReply) GetReason() string

func (*SendReply) GetSuccess

func (x *SendReply) GetSuccess() bool

func (*SendReply) ProtoMessage

func (*SendReply) ProtoMessage()

func (*SendReply) ProtoReflect added in v0.0.30

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

func (*SendReply) Reset

func (x *SendReply) Reset()

func (*SendReply) String

func (x *SendReply) String() string

type TruncateReply

type TruncateReply struct {
	Success bool   `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	Reason  string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
	// contains filtered or unexported fields
}

func (*TruncateReply) Descriptor deprecated

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

Deprecated: Use TruncateReply.ProtoReflect.Descriptor instead.

func (*TruncateReply) GetReason

func (x *TruncateReply) GetReason() string

func (*TruncateReply) GetSuccess

func (x *TruncateReply) GetSuccess() bool

func (*TruncateReply) ProtoMessage

func (*TruncateReply) ProtoMessage()

func (*TruncateReply) ProtoReflect added in v0.0.30

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

func (*TruncateReply) Reset

func (x *TruncateReply) Reset()

func (*TruncateReply) String

func (x *TruncateReply) String() string

type TruncateRequest

type TruncateRequest struct {
	Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
	// contains filtered or unexported fields
}

func (*TruncateRequest) Descriptor deprecated

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

Deprecated: Use TruncateRequest.ProtoReflect.Descriptor instead.

func (*TruncateRequest) GetTable

func (x *TruncateRequest) GetTable() string

func (*TruncateRequest) ProtoMessage

func (*TruncateRequest) ProtoMessage()

func (*TruncateRequest) ProtoReflect added in v0.0.30

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

func (*TruncateRequest) Reset

func (x *TruncateRequest) Reset()

func (*TruncateRequest) String

func (x *TruncateRequest) String() string

type Value

type Value struct {
	Type      DataType               `protobuf:"varint,1,opt,name=type,proto3,enum=gravity.sdk.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 added in v0.0.50

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

func GetValueByPath added in v0.0.47

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

func GetValueFromInterface added in v0.0.13

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 added in v0.0.47

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

func (*Value) GetMap

func (x *Value) GetMap() *MapValue

func (*Value) GetTimestamp added in v0.0.38

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 added in v0.0.30

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