common

package
v0.0.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DTMatchByFunc = "DATA_TRANSFER_CHECK_BY_FUNC"

Variables

View Source
var TypeToDefault = map[KafkaType]FieldReceiver{
	KafkaTypeInt8:    new(Int8ToInt8Default),
	KafkaTypeInt16:   new(Int16ToInt16Default),
	KafkaTypeInt32:   new(IntToInt32Default),
	KafkaTypeInt64:   new(Int64ToInt64Default),
	KafkaTypeBoolean: new(BooleanToBooleanDefault),
	KafkaTypeString:  new(StringToStringDefault),
	KafkaTypeFloat32: new(Float64ToFloat64Default),
	KafkaTypeFloat64: new(Float64ToFloat64Default),
	KafkaTypeStruct: &FieldReceiverMatchers{
		Matchers: []FieldReceiverMatcher{new(Point), new(VariableScaleDecimal)},
	},
	KafkaTypeBytes: &FieldReceiverMatchers{
		Matchers: []FieldReceiverMatcher{new(Decimal), new(StringToBytesDefault)},
	},
}

Functions

func IsUnknownTypeError

func IsUnknownTypeError(err error) bool

func NewUnknownTypeError

func NewUnknownTypeError(err error) error

Types

type AnyToAny

type AnyToAny interface {
	Do(interface{}, *OriginalTypeInfo, *Schema, bool) (interface{}, error) // string ret_val: result_type
}

AnyToAny it's: ArrayToAny & StructToAny

type AnyToDouble

type AnyToDouble interface {
	Do(interface{}, *OriginalTypeInfo, *Schema, bool) (json.Number, error)
}

AnyToDouble special for io.debezium.data.VariableScaleDecimal

type BooleanToBoolean

type BooleanToBoolean interface {
	Do(bool, *OriginalTypeInfo, *Schema, bool) (bool, error)
}

type BooleanToBooleanDefault

type BooleanToBooleanDefault struct {
	BooleanToBoolean
	YTTypeBoolean
	FieldReceiverMarker
}

func (*BooleanToBooleanDefault) Do

type BooleanToBytes

type BooleanToBytes interface {
	Do(bool, *OriginalTypeInfo, *Schema, bool) ([]byte, error)
}

type BooleanToInt8

type BooleanToInt8 interface {
	Do(bool, *OriginalTypeInfo, *Schema, bool) (int8, error)
}

type BooleanToString

type BooleanToString interface {
	Do(bool, *OriginalTypeInfo, *Schema, bool) (string, error)
}

type ChangeItemCanon

type ChangeItemCanon struct {
	ChangeItem     *abstract.ChangeItem
	DebeziumEvents []KeyValue
}

type ContainsColSchemaAdditionalInfo

type ContainsColSchemaAdditionalInfo interface {
	AddInfo(*Schema, *abstract.ColSchema)
}

ContainsColSchemaAdditionalInfo modifies ColSchema, adds special parameters

type Decimal

func (*Decimal) Do

func (d *Decimal) Do(in string, originalType *OriginalTypeInfo, schema *Schema, _ bool) (string, error)

func (*Decimal) IsMatched

func (d *Decimal) IsMatched(_ *OriginalTypeInfo, schema *Schema) bool

type DurationToInt64

type DurationToInt64 interface {
	Do(time.Duration, *OriginalTypeInfo, *Schema, bool) (int64, error)
}

type FieldReceiver

type FieldReceiver interface {
	IsFieldReceiver()
	YTTypeStorer
}

type FieldReceiverMarker

type FieldReceiverMarker struct{}

func (*FieldReceiverMarker) IsFieldReceiver

func (r *FieldReceiverMarker) IsFieldReceiver()

type FieldReceiverMatcher

type FieldReceiverMatcher interface {
	FieldReceiver
	IsMatched(originalType *OriginalTypeInfo, schema *Schema) bool
}

type FieldReceiverMatchers

type FieldReceiverMatchers struct {
	Matchers []FieldReceiverMatcher
}

func (*FieldReceiverMatchers) IsFieldReceiver

func (m *FieldReceiverMatchers) IsFieldReceiver()

func (*FieldReceiverMatchers) YTType

func (m *FieldReceiverMatchers) YTType() string

type Float64ToFloat32

type Float64ToFloat32 interface {
	Do(float64, *OriginalTypeInfo, *Schema, bool) (float32, error)
}

type Float64ToFloat32Default

type Float64ToFloat32Default struct {
	Float64ToFloat32
	YTTypeFloat32
	FieldReceiverMarker
}

func (*Float64ToFloat32Default) Do

type Float64ToFloat64

type Float64ToFloat64 interface {
	Do(float64, *OriginalTypeInfo, *Schema, bool) (float64, error)
}

type Float64ToFloat64Default

type Float64ToFloat64Default struct {
	Float64ToFloat64
	YTTypeFloat64
	FieldReceiverMarker
}

func (*Float64ToFloat64Default) Do

type Int16ToInt16

type Int16ToInt16 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (int16, error)
}

type Int16ToInt16Default

type Int16ToInt16Default struct {
	Int16ToInt16
	YTTypeInt16
	FieldReceiverMarker
}

func (*Int16ToInt16Default) Do

type Int16ToInt8

type Int16ToInt8 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (int8, error)
}

type Int16ToInt8Default

type Int16ToInt8Default struct {
	Int16ToInt8
	YTTypeInt8
	FieldReceiverMarker
}

func (*Int16ToInt8Default) Do

func (d *Int16ToInt8Default) Do(in int64, _ *OriginalTypeInfo, _ *Schema, _ bool) (int8, error)

type Int16ToUint16

type Int16ToUint16 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (uint16, error)
}

type Int16ToUint16Default

type Int16ToUint16Default struct {
	Int16ToUint16
	YTTypeUint16
	FieldReceiverMarker
}

func (*Int16ToUint16Default) Do

type Int16ToUint8

type Int16ToUint8 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (uint8, error)
}

type Int16ToUint8Default

type Int16ToUint8Default struct {
	Int16ToUint8
	YTTypeUint8
	FieldReceiverMarker
}

func (*Int16ToUint8Default) Do

type Int64ToInt32

type Int64ToInt32 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (int32, error)
}

type Int64ToInt64

type Int64ToInt64 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (int64, error)
}

type Int64ToInt64Default

type Int64ToInt64Default struct {
	Int64ToInt64
	YTTypeInt64
	FieldReceiverMarker
}

func (*Int64ToInt64Default) Do

type Int64ToTime

type Int64ToTime interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (time.Time, error)
}

type Int64ToUint32

type Int64ToUint32 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (uint32, error)
}

type Int64ToUint64

type Int64ToUint64 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (uint64, error)
}

type Int64ToUint64Default

type Int64ToUint64Default struct {
	Int64ToUint64
	YTTypeUint64
	FieldReceiverMarker
}

func (*Int64ToUint64Default) Do

type Int8ToInt8

type Int8ToInt8 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (int8, error)
}

type Int8ToInt8Default

type Int8ToInt8Default struct {
	Int8ToInt8
	YTTypeInt8
	FieldReceiverMarker
}

func (*Int8ToInt8Default) Do

func (d *Int8ToInt8Default) Do(in int64, _ *OriginalTypeInfo, _ *Schema, _ bool) (int8, error)

type Int8ToUint8

type Int8ToUint8 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (uint8, error)
}

type Int8ToUint8Default

type Int8ToUint8Default struct {
	Int8ToUint8
	YTTypeUint8
	FieldReceiverMarker
}

func (*Int8ToUint8Default) Do

type IntToInt32

type IntToInt32 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (int32, error)
}

IntToInt32 special case - generalization Int*ToInt32

type IntToInt32Default

type IntToInt32Default struct {
	IntToInt32
	YTTypeInt32
	FieldReceiverMarker
}

func (*IntToInt32Default) Do

func (d *IntToInt32Default) Do(in int64, _ *OriginalTypeInfo, _ *Schema, _ bool) (int32, error)

type IntToString

type IntToString interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (string, error)
}

IntToString special case - generalization Int*ToString

type IntToStringDefault

type IntToStringDefault struct {
	IntToString
	YTTypeString
	FieldReceiverMarker
}

func (*IntToStringDefault) Do

type IntToUint16

type IntToUint16 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (uint16, error)
}

type IntToUint16Default

type IntToUint16Default struct {
	IntToUint16
	YTTypeUint16
	FieldReceiverMarker
}

func (*IntToUint16Default) Do

type IntToUint32

type IntToUint32 interface {
	Do(int64, *OriginalTypeInfo, *Schema, bool) (uint32, error)
}

type IntToUint32Default

type IntToUint32Default struct {
	IntToUint32
	YTTypeUint32
	FieldReceiverMarker
}

func (*IntToUint32Default) Do

type KafkaType

type KafkaType string
const (
	KafkaTypeInt8    KafkaType = "int8"
	KafkaTypeInt16   KafkaType = "int16"
	KafkaTypeInt32   KafkaType = "int32"
	KafkaTypeInt64   KafkaType = "int64"
	KafkaTypeFloat32 KafkaType = "float"
	KafkaTypeFloat64 KafkaType = "double"
	KafkaTypeBoolean KafkaType = "boolean"
	KafkaTypeString  KafkaType = "string"
	KafkaTypeBytes   KafkaType = "bytes"
	KafkaTypeArray   KafkaType = "array"
	KafkaTypeMap     KafkaType = "map"
	KafkaTypeStruct  KafkaType = "struct"
)

type KafkaTypeDescr

type KafkaTypeDescr struct {
	KafkaTypeAndDebeziumNameAndExtra func(colSchema *abstract.ColSchema, intoArr, isSnapshot bool, connectorParameters map[string]string) (string, string, map[string]interface{})
}

type KeyValue

type KeyValue struct {
	DebeziumKey string
	DebeziumVal *string
}

type Message

type Message struct {
	Payload Payload `json:"payload"`
	Schema  Schema  `json:"schema"`
}

func UnmarshalMessage

func UnmarshalMessage(in string) (*Message, error)

type NotDefaultReceiverDescription

type NotDefaultReceiverDescription map[KafkaType]map[string]FieldReceiver

type OriginalTypeInfo

type OriginalTypeInfo struct {
	OriginalType string            `json:"original_type"`
	Properties   map[string]string `json:"properties,omitempty"`
}

func (*OriginalTypeInfo) GetArrElemTypeDescr

func (i *OriginalTypeInfo) GetArrElemTypeDescr() *OriginalTypeInfo

type Payload

type Payload struct {
	After       map[string]interface{} `json:"after"`
	Before      map[string]interface{} `json:"before"`
	Op          string                 `json:"op"`
	Source      Source                 `json:"source"`
	Transaction json.RawMessage        `json:"transaction"`
	TSMs        uint64                 `json:"ts_ms"`
}

func UnmarshalPayload

func UnmarshalPayload(in []byte) (*Payload, error)

type Point

type Point struct {
	AnyToAny
	YTTypeString
	FieldReceiverMarker
}

func (*Point) AddInfo

func (p *Point) AddInfo(_ *Schema, colSchema *abstract.ColSchema)

func (*Point) Do

func (p *Point) Do(in interface{}, _ *OriginalTypeInfo, _ *Schema, _ bool) (interface{}, error)

func (*Point) IsMatched

func (p *Point) IsMatched(_ *OriginalTypeInfo, schema *Schema) bool

type ResultTypes

type ResultTypes struct {
	ResultType            string
	AlternativeResultType []string
}

type Schema

type Schema struct {
	Field              string            `json:"field"`
	Fields             []Schema          `json:"fields"`
	Name               string            `json:"name"`
	Optional           bool              `json:"optional"`
	Parameters         *SchemaParameters `json:"parameters,omitempty"`
	Type               string            `json:"type"`
	Version            int               `json:"version"`
	Items              *Schema           `json:"items"`
	DTOriginalTypeInfo *OriginalTypeInfo `json:"__dt_original_type_info"`
}

func UnmarshalSchema

func UnmarshalSchema(in []byte) (*Schema, error)

func (*Schema) FindAfterSchema

func (schema *Schema) FindAfterSchema() *Schema

func (*Schema) FindBeforeSchema

func (schema *Schema) FindBeforeSchema() *Schema

func (*Schema) FindSchemaDescr

func (schema *Schema) FindSchemaDescr(fieldName string) *Schema

type SchemaParameters

type SchemaParameters struct {
	Length                  string `json:"length,omitempty"`
	ConnectDecimalPrecision string `json:"connect.decimal.precision,omitempty"`
	Scale                   string `json:"scale,omitempty"`
	Allowed                 string `json:"allowed,omitempty"`
}

type Source

type Source struct {
	Connector string `json:"connector"`
	DB        string `json:"db"`
	LSN       uint64 `json:"lsn"`
	Name      string `json:"name"`
	Schema    string `json:"schema"`
	Sequence  string `json:"sequence"`
	Snapshot  string `json:"snapshot"`
	Table     string `json:"table"`
	TSMs      uint64 `json:"ts_ms"`
	TXID      uint32 `json:"txId"`
	Version   string `json:"version"`
	XMin      *int   `json:"xmin"`
}

type StringToAny

type StringToAny interface {
	Do(string, *OriginalTypeInfo, *Schema, bool) (interface{}, error)
}

type StringToAnyDefault

type StringToAnyDefault struct {
	StringToAny
	YTTypeAny
	FieldReceiverMarker
}

func (*StringToAnyDefault) Do

func (d *StringToAnyDefault) Do(in string, _ *OriginalTypeInfo, _ *Schema, _ bool) (interface{}, error)

type StringToBytes

type StringToBytes interface {
	Do(string, *OriginalTypeInfo, *Schema, bool) ([]byte, error)
}

type StringToBytesDefault

type StringToBytesDefault struct {
	StringToBytes
	YTTypeBytes
	FieldReceiverMarker
}

func (*StringToBytesDefault) Do

func (d *StringToBytesDefault) Do(in string, _ *OriginalTypeInfo, _ *Schema, _ bool) ([]byte, error)

func (*StringToBytesDefault) IsMatched

func (d *StringToBytesDefault) IsMatched(_ *OriginalTypeInfo, _ *Schema) bool

type StringToString

type StringToString interface {
	Do(string, *OriginalTypeInfo, *Schema, bool) (string, error)
}

type StringToStringDefault

type StringToStringDefault struct {
	StringToString
	YTTypeString
	FieldReceiverMarker
}

func (*StringToStringDefault) Do

type StringToTime

type StringToTime interface {
	Do(string, *OriginalTypeInfo, *Schema, bool) (time.Time, error)
}

type StructToFloat64

type StructToFloat64 interface {
	Do(interface{}, *OriginalTypeInfo, *Schema, bool) (float64, error)
}

type StructToString

type StructToString interface {
	Do(interface{}, *OriginalTypeInfo, *Schema, bool) (string, error)
}

type UnknownTypeError

type UnknownTypeError interface {
	error
	IsUnknownTypeError()
}

type Values

type Values struct {
	ConnectorParameters map[string]string
	V                   map[string]interface{}
}

func NewValues

func NewValues(connectorParameters map[string]string) *Values

func (*Values) AddVal

func (v *Values) AddVal(colName string, colVal interface{})

type VariableScaleDecimal

type VariableScaleDecimal struct {
	AnyToDouble
	YTTypeFloat64
	FieldReceiverMarker
}

func (*VariableScaleDecimal) Do

func (d *VariableScaleDecimal) Do(in interface{}, _ *OriginalTypeInfo, _ *Schema, _ bool) (json.Number, error)

func (*VariableScaleDecimal) IsMatched

func (d *VariableScaleDecimal) IsMatched(_ *OriginalTypeInfo, schema *Schema) bool

type YTTypeAny

type YTTypeAny struct{}

func (*YTTypeAny) YTType

func (t *YTTypeAny) YTType() string

type YTTypeBoolean

type YTTypeBoolean struct{}

func (*YTTypeBoolean) YTType

func (t *YTTypeBoolean) YTType() string

type YTTypeBytes

type YTTypeBytes struct{}

func (*YTTypeBytes) YTType

func (t *YTTypeBytes) YTType() string

type YTTypeDate

type YTTypeDate struct{}

func (*YTTypeDate) YTType

func (t *YTTypeDate) YTType() string

type YTTypeDateTime

type YTTypeDateTime struct{}

func (*YTTypeDateTime) YTType

func (t *YTTypeDateTime) YTType() string

type YTTypeFloat32

type YTTypeFloat32 struct{}

func (*YTTypeFloat32) YTType

func (t *YTTypeFloat32) YTType() string

type YTTypeFloat64

type YTTypeFloat64 struct{}

func (*YTTypeFloat64) YTType

func (t *YTTypeFloat64) YTType() string

type YTTypeInt16

type YTTypeInt16 struct{}

func (*YTTypeInt16) YTType

func (t *YTTypeInt16) YTType() string

type YTTypeInt32

type YTTypeInt32 struct{}

func (*YTTypeInt32) YTType

func (t *YTTypeInt32) YTType() string

type YTTypeInt64

type YTTypeInt64 struct{}

func (*YTTypeInt64) YTType

func (t *YTTypeInt64) YTType() string

type YTTypeInt8

type YTTypeInt8 struct{}

func (*YTTypeInt8) YTType

func (t *YTTypeInt8) YTType() string

type YTTypeInterval

type YTTypeInterval struct{}

func (*YTTypeInterval) YTType

func (t *YTTypeInterval) YTType() string

type YTTypeStorer

type YTTypeStorer interface {
	YTType() string
}

type YTTypeString

type YTTypeString struct{}

func (*YTTypeString) YTType

func (t *YTTypeString) YTType() string

type YTTypeTimestamp

type YTTypeTimestamp struct{}

func (*YTTypeTimestamp) YTType

func (t *YTTypeTimestamp) YTType() string

type YTTypeUint16

type YTTypeUint16 struct{}

func (*YTTypeUint16) YTType

func (t *YTTypeUint16) YTType() string

type YTTypeUint32

type YTTypeUint32 struct{}

func (*YTTypeUint32) YTType

func (t *YTTypeUint32) YTType() string

type YTTypeUint64

type YTTypeUint64 struct{}

func (*YTTypeUint64) YTType

func (t *YTTypeUint64) YTType() string

type YTTypeUint8

type YTTypeUint8 struct{}

func (*YTTypeUint8) YTType

func (t *YTTypeUint8) YTType() string

Jump to

Keyboard shortcuts

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