filter

package
v3.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

Filter

filter provides a library to filter replicate on schema/table by given rules

Rules

rules like replication rules in MySQL, ref document: hhttps://dev.mysql.com/doc/refman/8.0/en/replication-rules-db-options.html https://dev.mysql.com/doc/refman/8.0/en/replication-rules-table-options.html

Priority and Key Points
  • DoDBs > IgnoreDBs
    • which rules to use?
      • If there are some DoDB rules, only use DoDB Rules
      • Otherwise if there are some IgnoreDB rules, use IgnoreDB rules
      • tables that are not filtered out or there are empty DoDBs/IgnoreDBs rules would go to filter on DoTables/IgnoreTables rules
  • DoTables > IgnoreTables
    • if there are DoTable Rules, but no one is matched, we would ignore corresponding table

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DMHeartbeatSchema = "dm_heartbeat"
	DMHeartbeatTable  = "heartbeat"
)

DM heartbeat schema / table name

Functions

func IsSystemSchema

func IsSystemSchema(schema string) bool

IsSystemSchema judge schema is system shema or not case insensitive

Types

type ActionType

type ActionType bool

ActionType is do or ignore something

const (
	Do     ActionType = true
	Ignore ActionType = false
)

builtin actiontype variable

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter implements whitelist and blacklist filters.

func New

func New(caseSensitive bool, rules *Rules) *Filter

New creates a filter use the rules.

type Rules

type Rules struct {
	DoTables []*Table `json:"do-tables" toml:"do-tables" yaml:"do-tables"`
	DoDBs    []string `json:"do-dbs" toml:"do-dbs" yaml:"do-dbs"`

	IgnoreTables []*Table `json:"ignore-tables" toml:"ignore-tables" yaml:"ignore-tables"`
	IgnoreDBs    []string `json:"ignore-dbs" toml:"ignore-dbs" yaml:"ignore-dbs"`
}

Rules contains Filter rules.

func (*Rules) ToLower

func (r *Rules) ToLower()

ToLower convert all entries to lowercase

type Table

type Table struct {
	Schema string `toml:"db-name" json:"db-name" yaml:"db-name"`
	Name   string `toml:"tbl-name" json:"tbl-name" yaml:"tbl-name"`
}

Table represents a table.

func (*Table) String

func (t *Table) String() string

String implements the fmt.Stringer interface.

Jump to

Keyboard shortcuts

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