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" Error ActionType = "Error" )
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" AlterDatabase EventType = "alter 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" CreateView EventType = "create view" DropView EventType = "drop view" AlterTable EventType = "alter table" CreateSchema EventType = "create schema" // alias of CreateDatabase DropSchema EventType = "drop schema" // alias of DropDatabase AlterSchema EventType = "alter schema" // alias of AlterDatabase AddTablePartition EventType = "add table partition" DropTablePartition EventType = "drop table partition" TruncateTablePartition EventType = "truncate table partition" IncompatibleDDLChanges EventType = "incompatible ddl changes" ValueRangeDecrease EventType = "value range decrease" PrecisionDecrease EventType = "precision decrease" ModifyColumn EventType = "modify column" RenameColumn EventType = "rename column" RenameIndex EventType = "rename index" DropColumn EventType = "drop column" DropPrimaryKey EventType = "drop primary key" DropUniqueKey EventType = "drop unique key" ModifyDefaultValue EventType = "modify default value" ModifyConstraint EventType = "modify constraint" ModifyColumnsOrder EventType = "modify columns order" ModifyCharset EventType = "modify charset" ModifyCollation EventType = "modify collation" RemoveAutoIncrement EventType = "remove auto increment" ModifyStorageEngine EventType = "modify storage engine" ReorganizePartition EventType = "reorganize table partition" RebuildPartition EventType = "rebuild table partition" CoalescePartition EventType = "coalesce table partition" SplitPartition EventType = "split table partition" ExchangePartition EventType = "exchange table partition" ModifySchemaCharsetAndCollate EventType = "modify schema charset and collate" ModifyTableCharsetAndCollate EventType = "modify table charset and collate" ModifyTableComment EventType = "modify table comment" RecoverTable EventType = "recover table" AlterTablePartitioning EventType = "alter table partitioning" RemovePartitioning EventType = "remove table partitioning" AddColumn EventType = "add column" SetDefaultValue EventType = "set default value" RebaseAutoID EventType = "rebase auto id" AddPrimaryKey EventType = "add primary key" AlterIndexVisibility EventType = "alter index visibility" AlterTTLInfo EventType = "alter ttl info" AlterTTLRemove EventType = "alter ttl remove" MultiSchemaChange EventType = "multi schema change" // NullEvent is used to represents unsupported ddl event type when we // convert a ast.StmtNode or a string to EventType. NullEvent EventType = "" )
show DML/DDL Events
func AstToDDLEvent ¶
AstToDDLEvent returns filter.DDLEvent
func ClassifyEvent ¶
ClassifyEvent classify event into dml/ddl