Documentation ¶
Index ¶
- Variables
- func Encoders() []string
- func GetCommonFormatKey(cf *types.CommonFormatEvent) string
- func GetLatestSchemaCodec(service string, db string, table string, typ string, input string, ...) (goavro.Codec, *goavro.RecordSetter, error)
- func GetOutputSchemaName(service string, db string, table string, input string, output string, ...) (string, error)
- func GetRowKey(s *types.TableSchema, row *[]interface{}) string
- func SchemaCodecHelper(avroSchema *types.AvroSchema) (goavro.Codec, *goavro.RecordSetter, error)
- func WrapEvent(outputFormat string, key string, bd []byte, seqno uint64) ([]byte, error)
- type Encoder
- type GenTimeFunc
- type GetLatestSchemaFunc
Constants ¶
This section is empty.
Variables ¶
var ZeroTime = time.Time{}.In(time.UTC)
ZeroTime in UTC
Functions ¶
func GetCommonFormatKey ¶
func GetCommonFormatKey(cf *types.CommonFormatEvent) string
GetCommonFormatKey concatenates common format key into string
func GetLatestSchemaCodec ¶
func GetLatestSchemaCodec(service string, db string, table string, typ string, input string, output string, version int) (goavro.Codec, *goavro.RecordSetter, error)
GetLatestSchemaCodec resolves schema and converts it to Avro codec and setter
func GetOutputSchemaName ¶
func GetOutputSchemaName(service string, db string, table string, input string, output string, version int) (string, error)
GetOutputSchemaName combines parameter into output topic name
func GetRowKey ¶
func GetRowKey(s *types.TableSchema, row *[]interface{}) string
GetRowKey concatenates row primary key fields into string TODO: Should we encode into byte array instead?
func SchemaCodecHelper ¶
func SchemaCodecHelper(avroSchema *types.AvroSchema) (goavro.Codec, *goavro.RecordSetter, error)
SchemaCodecHelper gets Avro codec and Avro record setter from schema structure
Types ¶
type Encoder ¶
type Encoder interface { Row(tp int, row *[]interface{}, seqNo uint64, ts time.Time) ([]byte, error) CommonFormat(cf *types.CommonFormatEvent) ([]byte, error) EncodeSchema(seqNo uint64) ([]byte, error) UpdateCodec() error Type() string Schema() *types.TableSchema UnwrapEvent(data []byte, cfEvent *types.CommonFormatEvent) (payload []byte, err error) DecodeEvent(b []byte) (*types.CommonFormatEvent, error) }
Encoder is unified interface to encode data from transit formats(row, common)
var Internal Encoder
Internal is encoder for intermediate buffer messages and message wrappers. Initialized in z.go
type GenTimeFunc ¶
type GenTimeFunc func() int64
GenTimeFunc created to be able to return deterministic timestamp in test TODO: Come up with better day of doing this
var GenTime GenTimeFunc = genTime
GenTime is polymorphic function to be able to replace common format timestamp generator
type GetLatestSchemaFunc ¶
type GetLatestSchemaFunc func(namespace string, schemaName string, typ string) (*types.AvroSchema, error)
GetLatestSchemaFunc is a type to implement schema resolver polymorphism
var GetLatestSchema GetLatestSchemaFunc
GetLatestSchema is the pointer to schema resolver