schema

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BitsSchemaName      = "io.debezium.data.Bits"
	EnumSchemaName      = "io.debezium.data.Enum"
	LtreeSchemaName     = "io.debezium.data.Lree"
	JsonSchemaName      = "io.debezium.data.Json"
	UuidSchemaName      = "io.debezium.data.Uuid"
	XmlSchemaName       = "io.debezium.data.Xml"
	GeographySchemaName = "io.debezium.data.geometry.Geography"
	GeometrySchemaName  = "io.debezium.data.geometry.Geometry"
	PointSchemaName     = "io.debezium.data.geometry.Point"
)
View Source
const MessageBlockSchemaName = "io.debezium.connector.postgresql.Message"
View Source
const MessageKeySchemaName = "io.debezium.connector.postgresql.MessageKey"
View Source
const MessageValueSchemaName = "io.debezium.connector.postgresql.MessageValue"
View Source
const SourceSchemaName = "io.debezium.connector.postgresql.Source"
View Source
const TimescaleEventSchemaName = "com.timescale.Event"

Variables

This section is empty.

Functions

This section is empty.

Types

type Buildable added in v0.3.1

type Buildable interface {
	SchemaBuilder() Builder
}

type Builder added in v0.4.0

type Builder interface {
	SchemaType() Type
	FieldName(
		fieldName string,
	) Builder
	GetFieldName() string
	SchemaName(
		schemaName string,
	) Builder
	GetSchemaName() string
	Optional() Builder
	Required() Builder
	SetOptional(
		optional bool,
	) Builder
	IsOptional() bool
	DefaultValue(
		defaultValue *string,
	) Builder
	GetDefaultValue() *string
	Version(
		version int,
	) Builder
	GetVersion() int
	Index(
		index int,
	) Builder
	GetIndex() int
	Documentation(
		documentation *string,
	) Builder
	GetDocumentation() *string
	Parameter(
		key string, value any,
	) Builder
	Parameters() map[string]any
	Field(
		name FieldName, index int, schemaBuilder Builder,
	) Builder
	Fields() map[string]Field
	KeySchema(
		builder Builder,
	) Builder
	GetKeySchema() Builder
	ValueSchema(
		builder Builder,
	) Builder
	GetValueSchema() Builder
	Clone() Builder
	Build() Struct
}

func Bits added in v0.3.1

func Bits(
	length int,
) Builder

func Boolean added in v0.3.1

func Boolean() Builder

func Bytes added in v0.3.1

func Bytes() Builder

func Enum added in v0.3.1

func Enum(
	enumValues []string,
) Builder

func Float32 added in v0.3.1

func Float32() Builder

func Float64 added in v0.3.1

func Float64() Builder

func Geography added in v0.9.0

func Geography() Builder

func Geometry added in v0.9.0

func Geometry() Builder

func HStore added in v0.5.0

func HStore() Builder

func Int16 added in v0.3.1

func Int16() Builder

func Int32 added in v0.3.1

func Int32() Builder

func Int64 added in v0.3.1

func Int64() Builder

func Int8 added in v0.3.1

func Int8() Builder

func Json added in v0.3.1

func Json() Builder

func Ltree added in v0.3.1

func Ltree() Builder

func Map added in v0.5.0

func Map() Builder

func NewSchemaBuilder added in v0.3.1

func NewSchemaBuilder(
	schemaType Type,
) Builder

func SourceSchema

func SourceSchema() Builder

func String added in v0.3.1

func String() Builder

func Uuid added in v0.3.1

func Uuid() Builder

func Xml added in v0.3.1

func Xml() Builder

type ColumnAlike added in v0.3.1

type ColumnAlike interface {
	Buildable
	Name() string
	DataType() uint32
	SchemaType() Type
	IsPrimaryKey() bool
}

type Field added in v0.3.1

type Field interface {
	Buildable
	Index() int
	SchemaStruct() Struct
}

type FieldName added in v0.3.1

type FieldName = string
const (
	FieldNameBefore      FieldName = "before"
	FieldNameAfter       FieldName = "after"
	FieldNameOperation   FieldName = "op"
	FieldNameSource      FieldName = "source"
	FieldNameTransaction FieldName = "transaction"
	FieldNameTimestamp   FieldName = "ts_ms"
	FieldNameTimescaleOp FieldName = "tsdb_op"
	FieldNameVersion     FieldName = "version"
	FieldNameSchema      FieldName = "schema"
	FieldNamePayload     FieldName = "payload"
	FieldNameConnector   FieldName = "connector"
	FieldNameName        FieldName = "name"
	FieldNameSnapshot    FieldName = "snapshot"
	FieldNameDatabase    FieldName = "db"
	FieldNameSequence    FieldName = "sequence"
	FieldNameTable       FieldName = "table"
	FieldNameTxId        FieldName = "txId"
	FieldNameLSN         FieldName = "lsn"
	FieldNameXmin        FieldName = "xmin"
	FieldNameType        FieldName = "type"
	FieldNameOptional    FieldName = "optional"
	FieldNameField       FieldName = "field"
	FieldNameFields      FieldName = "fields"
	FieldNameDefault     FieldName = "default"
	FieldNamePrefix      FieldName = "prefix"
	FieldNameContent     FieldName = "content"
	FieldNameMessage     FieldName = "message"
	FieldNameIndex       FieldName = "index"
	FieldNameKeySchema   FieldName = "keySchema"
	FieldNameValueSchema FieldName = "valueSchema"
	FieldNameAllowed     FieldName = "allowed"
	FieldNameLength      FieldName = "length"
)

type Identifiable added in v0.3.1

type Identifiable interface {
	// SchemaName returns the schema name of the entity
	SchemaName() string
	// TableName returns the table name of the entity
	TableName() string
	// CanonicalName returns the canonical name of the entity >>schema.table<<
	CanonicalName() string
}

type NameGenerator added in v0.3.1

type NameGenerator interface {
	// EventTopicName generates an event topic name for the given table
	EventTopicName(
		table TableAlike,
	) string
	// SchemaTopicName generates a schema topic name for the given v
	SchemaTopicName(
		table TableAlike,
	) string
	// MessageTopicName generates a message topic name for a replication message
	MessageTopicName() string
}

NameGenerator wraps a namingstrategy.NamingStrategy to simplify its usage with the topic prefix being predefined

func NewNameGenerator added in v0.4.0

func NewNameGenerator(
	topicPrefix string, namingStrategy namingstrategy.NamingStrategy,
) NameGenerator

func NewNameGeneratorFromConfig added in v0.4.0

func NewNameGeneratorFromConfig(
	c *config.Config, namingStrategy namingstrategy.NamingStrategy,
) NameGenerator

type Operation

type Operation string
const (
	OP_READ      Operation = "r"
	OP_CREATE    Operation = "c"
	OP_UPDATE    Operation = "u"
	OP_DELETE    Operation = "d"
	OP_TRUNCATE  Operation = "t"
	OP_MESSAGE   Operation = "m"
	OP_TIMESCALE Operation = "$"
)

type Struct

type Struct = map[FieldName]any

func CompressionEvent

func CompressionEvent(
	source Struct,
) Struct

func CreateEvent

func CreateEvent(
	record Struct, source Struct,
) Struct

func DecompressionEvent

func DecompressionEvent(
	source Struct,
) Struct

func DeleteEvent

func DeleteEvent(
	before, source Struct, tombstone bool,
) Struct

func Envelope

func Envelope(
	schema, payload Struct,
) Struct

func EnvelopeMessageSchema

func EnvelopeMessageSchema(
	nameGenerator NameGenerator,
) Struct

func EnvelopeSchema

func EnvelopeSchema(
	nameGenerator NameGenerator, table TableAlike,
) Struct

func KeySchema

func KeySchema(
	nameGenerator NameGenerator, table TableAlike,
) Struct

func MessageEvent

func MessageEvent(
	prefix string, content *string, source Struct,
) Struct

func MessageKey

func MessageKey(
	prefix string,
) Struct

func MessageKeySchema

func MessageKeySchema() Struct

func MessageValueSchema

func MessageValueSchema() Struct

func ReadEvent

func ReadEvent(
	record Struct, source Struct,
) Struct

func Source

func Source(
	lsn pglogrepl.LSN, timestamp time.Time, snapshot bool,
	databaseName, schemaName, hypertableName string, transactionId *uint32,
) Struct

func TimescaleEventKeySchema

func TimescaleEventKeySchema() Struct

func TimescaleKey

func TimescaleKey(
	schemaName, tableName string,
) Struct

func TruncateEvent

func TruncateEvent(
	source Struct,
) Struct

func UpdateEvent

func UpdateEvent(
	before, after, source Struct,
) Struct

type TableAlike added in v0.3.1

type TableAlike interface {
	Identifiable
	Buildable
	TableColumns() []ColumnAlike
	KeyIndexColumns() []ColumnAlike
}

type TimescaleOperation

type TimescaleOperation string
const (
	OP_COMPRESSION   TimescaleOperation = "c"
	OP_DECOMPRESSION TimescaleOperation = "d"
)

type Type added in v0.3.1

type Type string

Type is a string like definition of the available event stream data types

const (
	INT8    Type = "int8"
	INT16   Type = "int16"
	INT32   Type = "int32"
	INT64   Type = "int64"
	FLOAT32 Type = "float32"
	FLOAT64 Type = "float64"
	BOOLEAN Type = "boolean"
	STRING  Type = "string"
	BYTES   Type = "bytes"
	ARRAY   Type = "array"
	MAP     Type = "map"
	STRUCT  Type = "struct"
)

func (Type) IsPrimitive added in v0.3.1

func (st Type) IsPrimitive() bool

Jump to

Keyboard shortcuts

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