router

package
v1.1.0-beta.0...-f2db9c4 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SchemaExtractor

type SchemaExtractor struct {
	TargetColumn string `json:"target-column" toml:"target-column" yaml:"target-column"`
	SchemaRegexp string `json:"schema-regexp" toml:"schema-regexp" yaml:"schema-regexp"`
	// contains filtered or unexported fields
}

SchemaExtractor extracts schema name to column

type SourceExtractor

type SourceExtractor struct {
	TargetColumn string `json:"target-column" toml:"target-column" yaml:"target-column"`
	SourceRegexp string `json:"source-regexp" toml:"source-regexp" yaml:"source-regexp"`
	// contains filtered or unexported fields
}

SourceExtractor extracts source name to column

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) FetchExtendColumn

func (r *Table) FetchExtendColumn(schema, table, source string) ([]string, []string)

FetchExtendColumn get extract rule, return extracted cols and extracted vals.

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) (targetSchema string, targetTable string, err 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 TableExtractor

type TableExtractor struct {
	TargetColumn string `json:"target-column" toml:"target-column" yaml:"target-column"`
	TableRegexp  string `json:"table-regexp" toml:"table-regexp" yaml:"table-regexp"`
	// contains filtered or unexported fields
}

TableExtractor extracts table name to column

type TableRule

type TableRule struct {
	TableExtractor  *TableExtractor  `json:"extract-table,omitempty" toml:"extract-table,omitempty" yaml:"extract-table,omitempty"`
	SchemaExtractor *SchemaExtractor `json:"extract-schema,omitempty" toml:"extract-schema,omitempty" yaml:"extract-schema,omitempty"`
	SourceExtractor *SourceExtractor `json:"extract-source,omitempty" toml:"extract-source,omitempty" yaml:"extract-source,omitempty"`
	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