Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType string
ActionType indicates how to handle matched items
const ( Ignore ActionType = "Ignore" Do ActionType = "Do" )
show that how to handle rules
type BinlogEvent ¶
BinlogEvent filters binlog events by given rules
func NewBinlogEvent ¶
func NewBinlogEvent(caseSensitive bool, rules []*BinlogEventRule) (*BinlogEvent, error)
NewBinlogEvent returns a binlog event filter
func (*BinlogEvent) AddRule ¶
func (b *BinlogEvent) AddRule(rule *BinlogEventRule) error
AddRule adds a rule into binlog event filter
func (*BinlogEvent) Filter ¶
func (b *BinlogEvent) Filter(schema, table string, event EventType, rawQuery string) (ActionType, error)
Filter filters events or queries by given rules returns action and error
func (*BinlogEvent) RemoveRule ¶
func (b *BinlogEvent) RemoveRule(rule *BinlogEventRule) error
RemoveRule removes a rule from binlog event filter
func (*BinlogEvent) UpdateRule ¶
func (b *BinlogEvent) UpdateRule(rule *BinlogEventRule) error
UpdateRule updates binlog event filter rule
type BinlogEventRule ¶
type BinlogEventRule struct { SchemaPattern string `json:"schema-pattern" toml:"schema-pattern" yaml:"schema-pattern"` TablePattern string `json:"table-pattern" toml:"table-pattern" yaml:"table-pattern"` Events []EventType `json:"events" toml:"events" yaml:"events"` SQLPattern []string `json:"sql-pattern" toml:"sql-pattern" yaml:"sql-pattern"` // regular expression Action ActionType `json:"action" toml:"action" yaml:"action"` // contains filtered or unexported fields }
BinlogEventRule is a rule to filter binlog events
func (*BinlogEventRule) ToLower ¶
func (b *BinlogEventRule) ToLower()
ToLower covert schema/table pattern to lower case
func (*BinlogEventRule) Valid ¶
func (b *BinlogEventRule) Valid() error
Valid checks validity of rule.
type EventType ¶
type EventType string
EventType is DML/DDL Event type
const ( // it indicates all dml/ddl events in rule AllEvent EventType = "all" AllDDL EventType = "all ddl" AllDML EventType = "all dml" // it indicates no any dml/ddl events in rule, // and equals empty rule.DDLEvent/DMLEvent NoneEvent EventType = "none" NoneDDL EventType = "none ddl" NoneDML EventType = "none dml" InsertEvent EventType = "insert" UpdateEvent EventType = "update" DeleteEvent EventType = "delete" CreateDatabase EventType = "create database" DropDatabase EventType = "drop database" CreateTable EventType = "create table" DropTable EventType = "drop table" TruncateTable EventType = "truncate table" RenameTable EventType = "rename table" CreateIndex EventType = "create index" DropIndex EventType = "drop index" AlertTable EventType = "alter table" NullEvent EventType = "" )
show DML/DDL Events
func AstToDDLEvent ¶
AstToDDLEvent returns filter.DDLEvent
func ClassifyEvent ¶
ClassifyEvent classify event into dml/ddl