Documentation
¶
Index ¶
- func NewComparisonCondition(column, operator string, value interface{}) func(*utils.CDCMessage) bool
- func NewContainsCondition(column string, value interface{}) func(*utils.CDCMessage) bool
- type Config
- type ExcludeColumnRule
- type FilterRule
- type Rule
- type RuleConfig
- type RuleEngine
- type TransformRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewComparisonCondition ¶
func NewComparisonCondition(column, operator string, value interface{}) func(*utils.CDCMessage) bool
NewComparisonCondition creates a new comparison condition function
func NewContainsCondition ¶
func NewContainsCondition(column string, value interface{}) func(*utils.CDCMessage) bool
NewContainsCondition creates a new contains condition function
Types ¶
type Config ¶
type Config struct {
Tables map[string][]RuleConfig `yaml:"tables"`
}
Config represents the overall configuration for rules
type ExcludeColumnRule ¶ added in v0.0.14
func (*ExcludeColumnRule) Apply ¶ added in v0.0.14
func (r *ExcludeColumnRule) Apply(message *utils.CDCMessage) (*utils.CDCMessage, error)
Apply applies the exclude_column rule to the provided data
type FilterRule ¶
type FilterRule struct {
TableName string
ColumnName string
Condition func(*utils.CDCMessage) bool
Operations []utils.OperationType
AllowEmptyDeletes bool
}
FilterRule represents a rule that filters data
func (*FilterRule) Apply ¶
func (r *FilterRule) Apply(message *utils.CDCMessage) (*utils.CDCMessage, error)
Apply applies the filter rule to the provided data
type Rule ¶
type Rule interface {
Apply(message *utils.CDCMessage) (*utils.CDCMessage, error)
}
Rule interface defines the methods that all rules must implement
func NewExcludeColumnRule ¶ added in v0.0.14
func NewFilterRule ¶
NewFilterRule creates a new filter rule based on the provided parameters
type RuleConfig ¶
type RuleConfig struct {
Type string `yaml:"type"`
Column string `yaml:"column"`
Parameters map[string]interface{} `yaml:"parameters"`
Operations []utils.OperationType `yaml:"operations,omitempty"`
AllowEmptyDeletes bool `yaml:"allow_empty_deletes,omitempty"`
}
RuleConfig represents the configuration for a single rule
type RuleEngine ¶
type RuleEngine struct {
Rules map[string][]Rule // map of table name to slice of rules
// contains filtered or unexported fields
}
RuleEngine manages and applies rules to data
func NewRuleEngine ¶
func NewRuleEngine() *RuleEngine
NewRuleEngine creates a new RuleEngine instance
func (*RuleEngine) AddRule ¶
func (re *RuleEngine) AddRule(tableName string, rule Rule)
AddRule adds a new rule for the specified table
func (*RuleEngine) ApplyRules ¶
func (re *RuleEngine) ApplyRules(message *utils.CDCMessage) (*utils.CDCMessage, error)
ApplyRules applies all rules for the specified table to the given data
func (*RuleEngine) LoadRules ¶
func (re *RuleEngine) LoadRules(config Config) error
LoadRules loads rules from the provided configuration
type TransformRule ¶
type TransformRule struct {
TableName string
ColumnName string
Transform func(*utils.CDCMessage) (*utils.CDCMessage, error)
Operations []utils.OperationType
AllowEmptyDeletes bool
}
TransformRule represents a rule that transforms data
func NewMaskTransformRule ¶
func NewMaskTransformRule(table, column string, params map[string]interface{}) (*TransformRule, error)
NewMaskTransformRule creates a new mask transform rule
func NewRegexTransformRule ¶
func NewRegexTransformRule(table, column string, params map[string]interface{}) (*TransformRule, error)
NewRegexTransformRule creates a new regex transform rule
func (*TransformRule) Apply ¶
func (r *TransformRule) Apply(message *utils.CDCMessage) (*utils.CDCMessage, error)
Apply applies the transform rule to the provided data