message

package
v1.1.10-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// STATUS_NEW a new message
	STATUS_NEW = iota
	// STATUS_SEND message has be sended
	STATUS_SEND
	// STATUS_RECORD message has be recorded
	STATUS_RECORD
)

Variables

View Source
var Pool = sync.Pool{
	New: func() interface{} {
		return &Message{}
	},
}

Pool reuse message object

Functions

func Put added in v1.1.3

func Put(msg *Message)

Types

type AlterTable

type AlterTable struct {
}

AlterTable for mysql ddl

type Content

type Content struct {
	Head Head        `json:"head"`
	Data interface{} `json:"data"`
}

Content of Message

type CreateTable

type CreateTable struct {
}

CreateTable for mysql ddl

type Delete

type Delete struct {
	Old map[string]interface{} `json:"old"`
}

Delete for mysql delete

type Head struct {
	Type     string            `json:"type"`
	Time     uint32            `json:"time"`
	Database string            `json:"database"`
	Table    string            `json:"table"`
	Position pipeline.Position `json:"position"`
}

Head of Message

type Insert

type Insert struct {
	New map[string]interface{} `json:"new"`
}

Insert for mysql insert

type Message

type Message struct {
	Status  int16
	Filter  bool
	Content Content
}

Message basic message for pipeline handle

func Get added in v1.1.3

func Get() *Message

func New

func New() *Message

New return a new message

func (*Message) Json

func (msg *Message) Json() (string, error)

Json marshal message to json data

func (*Message) JsonContent

func (msg *Message) JsonContent() (string, error)

JsonContent only marshal message's content to josn data

func (*Message) Table added in v1.1.3

func (msg *Message) Table() string

Table returns table with database

func (*Message) ToString

func (msg *Message) ToString() string

ToString returns message's string data

type MessageType

type MessageType byte

MessageType for pipeline handle

var (
	TYPE_EMPTY        MessageType = 0
	TYPE_INSERT       MessageType = 1
	TYPE_UPDATE       MessageType = 2
	TYPE_DELETE       MessageType = 3
	TYPE_CREATE_TABLE MessageType = 4
	TYPE_ALTER_TABLE  MessageType = 5
)

func (MessageType) String

func (mt MessageType) String() string

String returns MessageType's string

type STATUS

type STATUS int16

STATUS for message control

type Update

type Update struct {
	Old map[string]interface{} `json:"old"`
	New map[string]interface{} `json:"new"`
}

Update for mysql update

Jump to

Keyboard shortcuts

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