transformer

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnonRuleParser added in v0.8.4

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

AnonRuleParser is a wrapper around a transformer rule parser that fetches and converts anon extension security labels into transformation rules before validation is performed

func NewAnonRuleParser added in v0.8.4

func NewAnonRuleParser(ctx context.Context, pgURL string, dumpToFile bool, logger loglib.Logger, parser ParseFn) (*AnonRuleParser, error)

NewAnonRuleParser is a wrapper around a parser that fetches and converts anon extension security labels into transformation rules before validation is performed

func (*AnonRuleParser) Close added in v0.8.4

func (a *AnonRuleParser) Close() error

func (*AnonRuleParser) ParseAndValidate added in v0.8.4

func (a *AnonRuleParser) ParseAndValidate(ctx context.Context, rules Rules) (map[string]ColumnTransformers, error)

ParseAndValidate will fetch the anon masking rules from the source database and convert them into transformation rules before passing them to the wrapped parser for validation.

type ColumnTransformers added in v0.5.0

type ColumnTransformers map[string]transformers.Transformer

type Config

type Config struct {
	InferFromSecurityLabels bool
	DumpInferredRules       bool
	TransformerRules        []TableRules
	ValidationMode          string
}

type Option

type Option func(t *Transformer)

func WithLogger

func WithLogger(l loglib.Logger) Option

func WithParser added in v0.5.0

func WithParser(parser ParseFn) Option

type ParseFn added in v0.5.0

type ParseFn func(ctx context.Context, rules Rules) (map[string]ColumnTransformers, error)

type PostgresTransformerParser added in v0.5.0

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

func NewPostgresTransformerParser added in v0.5.0

func NewPostgresTransformerParser(ctx context.Context, pgURL string, builder transformerBuilder, requiredTables []string) (*PostgresTransformerParser, error)

func (*PostgresTransformerParser) Close added in v0.5.0

func (v *PostgresTransformerParser) Close() error

func (*PostgresTransformerParser) ParseAndValidate added in v0.5.0

func (v *PostgresTransformerParser) ParseAndValidate(ctx context.Context, rules Rules) (map[string]ColumnTransformers, error)

type Rules

type Rules struct {
	Transformers   []TableRules `yaml:"transformations"`
	ValidationMode string       `yaml:"validation_mode"`
}

type TableRules

type TableRules struct {
	Schema         string                      `yaml:"schema"`
	Table          string                      `yaml:"table"`
	ColumnRules    map[string]TransformerRules `yaml:"column_transformers"`
	ValidationMode string                      `yaml:"validation_mode"`
}

type Transformer

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

Transformer is a decorator around a wal processor that transforms wal event column values following the configured transformation rules.

func New

func New(ctx context.Context, cfg *Config, processor processor.Processor, builder transformerBuilder, opts ...Option) (*Transformer, error)

New will return a transformer processor wrapper that will transform incoming wal event column values as configured by the transformation rules.

func (*Transformer) Close

func (t *Transformer) Close() error

func (*Transformer) Name

func (t *Transformer) Name() string

func (*Transformer) ProcessWALEvent

func (t *Transformer) ProcessWALEvent(ctx context.Context, event *wal.Event) error

type TransformerRules

type TransformerRules struct {
	Name              string         `yaml:"name"`
	Parameters        map[string]any `yaml:"parameters"`
	DynamicParameters map[string]any `yaml:"dynamic_parameters"`
}

Jump to

Keyboard shortcuts

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