transformation

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package transformation provides transformation model configuration and validation

Index

Constants

View Source
const TransformationTypeExec = "exec"

TransformationTypeExec identifies exec transformation models

View Source
const TransformationTypeSQL = "sql"

TransformationTypeSQL identifies SQL transformation models

Variables

View Source
var (
	// ErrDatabaseRequired is returned when database is not specified
	ErrDatabaseRequired = errors.New("database is required")
	// ErrTableRequired is returned when table is not specified
	ErrTableRequired = errors.New("table is required")
	// ErrPartitionRequired is returned when partition is not specified
	ErrPartitionRequired = errors.New("partition is required")
	// ErrIntervalRequired is returned when interval is not specified
	ErrIntervalRequired = errors.New("interval is required")
	// ErrBackfillRequired is returned when backfill is not specified
	ErrBackfillRequired = errors.New("backfill is required")
	// ErrDependenciesRequired is returned when dependencies are not specified
	ErrDependenciesRequired = errors.New("dependencies is required")
	// ErrScheduleRequiredForBackfill is returned when schedule is not specified for backfill
	ErrScheduleRequiredForBackfill = errors.New("schedule is required when backfill is enabled")
)
View Source
var (
	// ErrInvalidFrontmatter is returned when frontmatter is invalid
	ErrInvalidFrontmatter = errors.New("invalid frontmatter")
	// ErrSQLContentRequired is returned when SQL content is not specified
	ErrSQLContentRequired = errors.New("sql content is required")
)
View Source
var (
	// ErrExecRequired is returned when exec is not specified
	ErrExecRequired = errors.New("exec is required")
)

Functions

func ValidateScheduleFormat

func ValidateScheduleFormat(schedule string) error

ValidateScheduleFormat validates a cron schedule expression

Types

type BackfillConfig

type BackfillConfig struct {
	Enabled  bool   `yaml:"enabled,omitempty"`
	Schedule string `yaml:"schedule,omitempty"`
	Minimum  uint64 `yaml:"minimum,omitempty"`
}

BackfillConfig defines backfill configuration for transformations

func (*BackfillConfig) Validate

func (c *BackfillConfig) Validate() error

Validate checks if the backfill configuration is valid

type Config

type Config struct {
	Database     string          `yaml:"database"`
	Table        string          `yaml:"table"`
	Partition    string          `yaml:"partition"`
	Interval     uint64          `yaml:"interval"`
	Schedule     string          `yaml:"schedule"`
	Backfill     *BackfillConfig `yaml:"backfill,omitempty"`
	Dependencies []string        `yaml:"dependencies"`
	Tags         []string        `yaml:"tags"`
}

Config defines the configuration for transformation models

func (*Config) GetID

func (c *Config) GetID() string

GetID returns the unique identifier for the transformation model

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the transformation configuration is valid

type Exec

type Exec struct {
	Config `yaml:",inline"`
	Exec   string `yaml:"exec"`
}

Exec represents a transformation exec model with YAML config

func NewTransformationExec

func NewTransformationExec(content []byte) (*Exec, error)

NewTransformationExec creates a new transformation exec model from content

func (*Exec) GetConfig

func (c *Exec) GetConfig() Config

GetConfig returns the transformation model configuration

func (*Exec) GetType

func (c *Exec) GetType() string

GetType returns the transformation model type

func (*Exec) GetValue

func (c *Exec) GetValue() string

GetValue returns the exec command

func (*Exec) Validate

func (c *Exec) Validate() error

Validate checks if the transformation exec model is valid

type ExecParser

type ExecParser struct{}

ExecParser parses exec transformation models

type SQL

type SQL struct {
	Config  `yaml:",inline"`
	Content string `yaml:"-"`
}

SQL represents a transformation SQL model with YAML frontmatter

func NewTransformationSQL

func NewTransformationSQL(content []byte) (*SQL, error)

NewTransformationSQL creates a new transformation SQL model from content

func (*SQL) GetConfig

func (c *SQL) GetConfig() Config

GetConfig returns the transformation model configuration

func (*SQL) GetType

func (c *SQL) GetType() string

GetType returns the transformation model type

func (*SQL) GetValue

func (c *SQL) GetValue() string

GetValue returns the SQL content

func (*SQL) Validate

func (c *SQL) Validate() error

Validate checks if the transformation SQL model is valid

type SQLParser

type SQLParser struct{}

SQLParser parses SQL transformation models

Jump to

Keyboard shortcuts

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