Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyTable = errors.New("query builder: empty table") ErrEmptyValues = errors.New("query builder: empty values") ErrEmptyWhere = errors.New("query builder: empty where clause") )
View Source
var (
ErrColumnNotFound = errors.New("column not found")
)
Functions ¶
Types ¶
type BaseEventHandler ¶
type BaseEventHandler struct {
// contains filtered or unexported fields
}
BaseEventHandler is a default implementation of the EventHandler. Use it as base for your custom handlers in the plugins.
func NewBaseEventHandler ¶
func NewBaseEventHandler(table string) *BaseEventHandler
func (*BaseEventHandler) OnRows ¶
func (eH *BaseEventHandler) OnRows(e *RowsEvent) ([]*Query, error)
func (*BaseEventHandler) OnTableChanged ¶ added in v1.1.0
func (eH *BaseEventHandler) OnTableChanged(_ SourceInfo) error
func (*BaseEventHandler) Skip ¶
func (eH *BaseEventHandler) Skip(cols []string)
Skip sets list of columns which should be skipped during the replication.
This option is mutually exclusive with SyncOnly.
func (*BaseEventHandler) SyncOnly ¶
func (eH *BaseEventHandler) SyncOnly(cols []string)
SyncOnly sets list of columns which should be replicated.
This option is mutually exclusive with Skip.
type Column ¶
type ColumnType ¶
type ColumnType int
const ( TypeNumber ColumnType = iota + 1 // tinyint, smallint, int, bigint, year TypeFloat // float, double TypeEnum // enum TypeSet // set TypeString // char, varchar, etc. TypeDatetime // datetime TypeTimestamp // timestamp TypeDate // date TypeTime // time TypeBit // bit TypeJSON // json TypeDecimal // decimal TypeMediumInt // medium int TypeBinary // binary, varbinary TypePoint // coordinates )
type EventHandler ¶
type EventHandler interface { OnTableChanged(info SourceInfo) error OnRows(e *RowsEvent) ([]*Query, error) }
EventHandler handles incoming events from the master.
type RowsEvent ¶
type RowsEvent struct { Action Action Source SourceInfo // Rows is a changed row list. // // Update events has even rows number. // Two rows for one update event: [before update row, after update row]. Rows [][]interface{} }
type Rule ¶
type Rule struct { Source SourceInfo Handler EventHandler }
type SourceInfo ¶
func (SourceInfo) FindColumnByName ¶ added in v1.1.0
func (info SourceInfo) FindColumnByName(name string) (Column, error)
Click to show internal directories.
Click to hide internal directories.