transformation

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: GPL-3.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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")
	// ErrNoProcessingConfig is returned when neither forwardfill nor backfill is specified
	ErrNoProcessingConfig = errors.New("at least one of forwardfill or backfill must be configured")
	// ErrIntervalRequired is returned when interval is not specified
	ErrIntervalRequired = errors.New("interval is required")
	// ErrScheduleRequired is returned when schedule is not specified
	ErrScheduleRequired = errors.New("schedule is required")
	// ErrIncompleteConfig is returned when config has interval but no schedule or vice versa
	ErrIncompleteConfig = errors.New("both interval and schedule must be specified")
	// ErrDependenciesRequired is returned when dependencies are not specified
	ErrDependenciesRequired = errors.New("dependencies is required")
	// ErrInvalidLimits is returned when min limit is greater than max limit
	ErrInvalidLimits = errors.New("min limit cannot be greater than max limit")
	// ErrInvalidPartialInterval is returned when min_partial_interval exceeds interval
	ErrInvalidPartialInterval = errors.New("min_partial_interval cannot exceed interval")
	// ErrPartialIntervalRequiresFlag is returned when min_partial_interval is set without allow_partial_intervals
	ErrPartialIntervalRequiresFlag = errors.New("min_partial_interval requires allow_partial_intervals to be true")
)
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 {
	Interval uint64 `yaml:"interval"`
	Schedule string `yaml:"schedule"`
}

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"`
	Limits       *LimitsConfig      `yaml:"limits,omitempty"`
	ForwardFill  *ForwardFillConfig `yaml:"forwardfill"`
	Backfill     *BackfillConfig    `yaml:"backfill,omitempty"`
	Dependencies []string           `yaml:"dependencies"`
	Tags         []string           `yaml:"tags"`
}

Config defines the configuration for transformation models

func (*Config) GetBackfillInterval added in v0.0.2

func (c *Config) GetBackfillInterval() uint64

GetBackfillInterval returns the interval for backfill operations

func (*Config) GetForwardInterval added in v0.0.2

func (c *Config) GetForwardInterval() uint64

GetForwardInterval returns the interval for forward fill operations

func (*Config) GetForwardSchedule added in v0.0.2

func (c *Config) GetForwardSchedule() string

GetForwardSchedule returns the schedule for forward fill operations

func (*Config) GetID

func (c *Config) GetID() string

GetID returns the unique identifier for the transformation model

func (*Config) GetMaxLimit added in v0.0.2

func (c *Config) GetMaxLimit() uint64

GetMaxLimit returns the maximum position limit (0 means no limit)

func (*Config) GetMinLimit added in v0.0.2

func (c *Config) GetMinLimit() uint64

GetMinLimit returns the minimum position limit

func (*Config) GetMinPartialInterval added in v0.0.6

func (c *Config) GetMinPartialInterval() uint64

GetMinPartialInterval returns the minimum partial interval for forward fill

func (*Config) HasLimits added in v0.0.2

func (c *Config) HasLimits() bool

HasLimits returns true if limits are configured

func (*Config) IsBackfillEnabled added in v0.0.2

func (c *Config) IsBackfillEnabled() bool

IsBackfillEnabled returns true if backfill is configured

func (*Config) IsPartialIntervalsAllowed added in v0.0.6

func (c *Config) IsPartialIntervalsAllowed() bool

IsPartialIntervalsAllowed returns true if partial intervals are allowed for forward fill

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 ForwardFillConfig added in v0.0.2

type ForwardFillConfig struct {
	Interval              uint64 `yaml:"interval"`
	Schedule              string `yaml:"schedule"`
	AllowPartialIntervals bool   `yaml:"allow_partial_intervals,omitempty"` // Allow sub-interval processing when dependencies partially available
	MinPartialInterval    uint64 `yaml:"min_partial_interval,omitempty"`    // Minimum interval size for partial processing (0 = no minimum)
}

ForwardFillConfig defines forward fill configuration for transformations

func (*ForwardFillConfig) Validate added in v0.0.2

func (c *ForwardFillConfig) Validate() error

Validate checks if the forward fill configuration is valid

type LimitsConfig added in v0.0.2

type LimitsConfig struct {
	Min uint64 `yaml:"min,omitempty"`
	Max uint64 `yaml:"max,omitempty"`
}

LimitsConfig defines position limits for transformations

func (*LimitsConfig) Validate added in v0.0.2

func (c *LimitsConfig) Validate() error

Validate checks if the limits configuration is valid

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