encoding

package
v0.9.71 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Version01      = "0.1"
	Version20Alpha = "2.0.alpha"
)

Variables

This section is empty.

Functions

func DataMapToPB added in v0.9.22

func DataMapToPB(data map[string]interface{}) (map[string]*types.Any, error)

func DecodeMsgFromPB added in v0.9.22

func DecodeMsgFromPB(pbmsg *msgpb.Msg) (*core.Msg, error)

func DecodeMsgHeaderFromPB added in v0.9.22

func DecodeMsgHeaderFromPB(pbmsg *msgpb.Msg) (*core.Msg, error)

func EncodeMsgHeaderToPB added in v0.9.22

func EncodeMsgHeaderToPB(msg *core.Msg) (*msgpb.Msg, error)

func EncodeMsgToPB added in v0.9.22

func EncodeMsgToPB(msg *core.Msg) (*msgpb.Msg, error)

func InterfaceValueToPB added in v0.9.22

func InterfaceValueToPB(v interface{}) (*types.Any, error)

func PBToDataMap added in v0.9.22

func PBToDataMap(data map[string]*types.Any) (map[string]interface{}, error)

func PbToInterface added in v0.9.22

func PbToInterface(v *types.Any) (interface{}, error)

Types

type DDLJson_2_0

type DDLJson_2_0 struct {
	MysqlJson_2_0_header
	SQL string `json:"sql"`
}

type DDLMsg_0_1

type DDLMsg_0_1 struct {
	MysqlJson_0_1_header
	SQL string `json:"sql"`
}

type DmlJson_2_0

type DmlJson_2_0 struct {
	MysqlJson_2_0_header
	Data map[string]interface{}
	Old  map[string]interface{}
	Pks  map[string]interface{}
}

type DmlStringMsg_0_1

type DmlStringMsg_0_1 struct {
	MysqlJson_0_1_header
	Data map[string]*string `json:"data"`
	Old  map[string]*string `json:"old"`
	Pks  map[string]*string `json:"pks,omitempty"`
}

type Encoder

type Encoder interface {
	Serialize(msg *core.Msg, version string) ([]byte, error)
	Deserialize(b []byte) (core.Msg, error)
}

func NewEncoder

func NewEncoder(input string, format string) Encoder

type JsonMsg01

type JsonMsg01 struct {
	Version          string  `json:"version"`
	Database         string  `json:"database"`
	Collection       string  `json:"collection"`
	UniqueSourceName string  `json:"unique_source_name"`
	Oplog            *gtm.Op `json:"oplog"`
}

type JsonMsgVersion20

type JsonMsgVersion20 struct {
	Version    string                 `json:"version"`
	Database   string                 `json:"database"`
	Collection string                 `json:"collection"`
	Data       map[string]interface{} `json:"data"`
	Row        map[string]interface{} `json:"row"`
}

type MysqlJson_0_1_header

type MysqlJson_0_1_header struct {
	Version   string `json:"version"`
	Database  string `json:"database"`
	Table     string `json:"table"`
	Type      string `json:"type"`
	Timestamp int64  `json:"ts"`
	TimeZone  string `json:"time_zone"`
	Host      string `json:"host"`
}

version 0.1

type MysqlJson_2_0_header

type MysqlJson_2_0_header struct {
	Version  string `json:"version"`
	Database string `json:"database"`
	Table    string `json:"table"`
	Type     string `json:"type"`
}

version 2.0

Jump to

Keyboard shortcuts

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