Documentation ¶
Index ¶
- Variables
- func SetPartitionRule(instanceIDSize, schemaIDSize, tableIDSize int)
- type Expr
- type Mapping
- func (m *Mapping) AddRule(rule *Rule) error
- func (m *Mapping) HandleDDL(schema, table string, columns []string, statement string) (string, []int, error)
- func (m *Mapping) HandleRowValue(schema, table string, columns []string, vals []interface{}) ([]interface{}, []int, error)
- func (m *Mapping) RemoveRule(rule *Rule) error
- func (m *Mapping) UpdateRule(rule *Rule) error
- type Rule
Constants ¶
This section is empty.
Variables ¶
View Source
var Exprs = map[Expr]func(*mappingInfo, []interface{}) ([]interface{}, error){ AddPrefix: addPrefix, AddSuffix: addSuffix, PartitionID: partitionID, }
Exprs is some built-in expression for column mapping only supports some poor expressions now, we would unify tableInfo later and support more
Functions ¶
func SetPartitionRule ¶
func SetPartitionRule(instanceIDSize, schemaIDSize, tableIDSize int)
SetPartitionRule sets bit size of schema ID and table ID
Types ¶
type Mapping ¶
type Mapping struct { selector.Selector // contains filtered or unexported fields }
Mapping maps column to something by rules
func NewMapping ¶
NewMapping returns a column mapping
func (*Mapping) HandleDDL ¶
func (m *Mapping) HandleDDL(schema, table string, columns []string, statement string) (string, []int, error)
HandleDDL handles ddl
func (*Mapping) HandleRowValue ¶
func (m *Mapping) HandleRowValue(schema, table string, columns []string, vals []interface{}) ([]interface{}, []int, error)
HandleRowValue handles row value
func (*Mapping) RemoveRule ¶
RemoveRule removes a rule from mapping
func (*Mapping) UpdateRule ¶
UpdateRule updates mapping rule
type Rule ¶
type Rule struct { PatternSchema string `yaml:"schema-pattern" json:"schema-pattern" toml:"schema-pattern"` PatternTable string `yaml:"table-pattern" json:"table-pattern" toml:"table-pattern"` SourceColumn string `yaml:"source-column" json:"source-column" toml:"source-column"` // modify, add refer column, ignore TargetColumn string `yaml:"target-column" json:"target-column" toml:"target-column"` // add column, modify Expression Expr `yaml:"expression" json:"expression" toml:"expression"` Arguments []string `yaml:"arguments" json:"arguments" toml:"arguments"` CreateTableQuery string `yaml:"create-table-query" json:"create-table-query" toml:"create-table-query"` }
Rule is a rule to map column TODO: we will do it later, if we need to implement a real column mapping, we need table structure of source and target system
Click to show internal directories.
Click to hide internal directories.