Documentation
¶
Index ¶
- func Encoders() []string
- func GetCommonFormatKey(cf *types.CommonFormatEvent) string
- func GetLatestSchemaCodec(service string, db string, table string, typ string) (goavro.Codec, *goavro.RecordSetter, error)
- func GetOutputSchemaName(service string, db string, table string) string
- func GetRowKey(s *types.TableSchema, row *[]interface{}) string
- func GetSchemaWebster(namespace string, schemaName string, typ string) (*types.AvroSchema, error)
- func SchemaCodecHelper(avroSchema *types.AvroSchema) (goavro.Codec, *goavro.RecordSetter, error)
- type Encoder
- type GenTimeFunc
- type GetLatestSchemaFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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) (goavro.Codec, *goavro.RecordSetter, error)
GetLatestSchemaCodec resolves schema and converts it to Avro codec and setter
func GetOutputSchemaName ¶
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 GetSchemaWebster ¶
GetSchemaWebster makes a GET HTTP call to webster schema service to get the latest schema version for a given namespace and schema name.
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) ([]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 = GetSchemaWebster
GetLatestSchema is the pointer to schema resolver