router

package
v3.0.1+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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Table

type Table struct {
	selector.Selector
	// contains filtered or unexported fields
}

Table routes schema/table to target schema/table by given route rules

func NewTableRouter

func NewTableRouter(caseSensitive bool, rules []*TableRule) (*Table, error)

NewTableRouter returns a table router

func (*Table) AddRule

func (r *Table) AddRule(rule *TableRule) error

AddRule adds a rule into table router

func (*Table) RemoveRule

func (r *Table) RemoveRule(rule *TableRule) error

RemoveRule removes a rule from table router

func (*Table) Route

func (r *Table) Route(schema, table string) (string, string, error)

Route routes schema/table to target schema/table don't support to route schema/table to multiple schema/table

func (*Table) UpdateRule

func (r *Table) UpdateRule(rule *TableRule) error

UpdateRule updates rule

type TableRule

type TableRule struct {
	SchemaPattern string `json:"schema-pattern" toml:"schema-pattern" yaml:"schema-pattern"`
	TablePattern  string `json:"table-pattern" toml:"table-pattern" yaml:"table-pattern"`
	TargetSchema  string `json:"target-schema" toml:"target-schema" yaml:"target-schema"`
	TargetTable   string `json:"target-table" toml:"target-table" yaml:"target-table"`
}

TableRule is a rule to route schema/table to target schema/table pattern format refers 'pkg/table-rule-selector'

func (*TableRule) ToLower

func (t *TableRule) ToLower()

ToLower covert schema/table parttern to lower case

func (*TableRule) Valid

func (t *TableRule) Valid() error

Valid checks validity of rule

Jump to

Keyboard shortcuts

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