external

package
v0.0.8 Latest Latest
Warning

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

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

Documentation

Overview

Package external provides external model configuration and validation

Index

Constants

View Source
const ExternalTypeSQL = "sql"

ExternalTypeSQL identifies SQL external 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")
	// ErrCacheConfigRequired is returned when cache configuration is not specified
	ErrCacheConfigRequired = errors.New("cache configuration is required")
	// ErrInvalidIncrementalInterval is returned when incremental scan interval is invalid
	ErrInvalidIncrementalInterval = errors.New("incremental_scan_interval must be positive")
	// ErrInvalidFullInterval is returned when full scan interval is invalid
	ErrInvalidFullInterval = errors.New("full_scan_interval must be positive")
	// ErrInvalidIntervalOrder is returned when incremental interval is not less than full interval
	ErrInvalidIntervalOrder = errors.New("incremental_scan_interval must be less than full_scan_interval")
)
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")
)

Functions

This section is empty.

Types

type CacheConfig added in v0.0.2

type CacheConfig struct {
	IncrementalScanInterval time.Duration `yaml:"incremental_scan_interval"`
	FullScanInterval        time.Duration `yaml:"full_scan_interval"`
}

CacheConfig defines caching configuration for external models

type Config

type Config struct {
	Database string       `yaml:"database"` // Optional, can fall back to default
	Table    string       `yaml:"table" validate:"required"`
	Cache    *CacheConfig `yaml:"cache"`
	Lag      uint64       `yaml:"lag"`
}

Config defines configuration for external models

func (*Config) GetID

func (c *Config) GetID() string

GetID returns the unique identifier for the external model

func (*Config) SetDefaults added in v0.0.8

func (c *Config) SetDefaults(defaultDatabase string)

SetDefaults applies default values to the configuration

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the external configuration is valid

type SQL

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

SQL represents an external SQL model with YAML frontmatter

func NewExternalSQL

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

NewExternalSQL creates a new external SQL model from content

func (*SQL) GetConfig

func (c *SQL) GetConfig() Config

GetConfig returns the external model configuration

func (*SQL) GetType

func (c *SQL) GetType() string

GetType returns the external model type

func (*SQL) GetValue

func (c *SQL) GetValue() string

GetValue returns the SQL content

func (*SQL) SetDefaultDatabase added in v0.0.8

func (c *SQL) SetDefaultDatabase(defaultDB string)

SetDefaultDatabase applies the default database if not already set

func (*SQL) Validate

func (c *SQL) Validate() error

Validate checks if the external SQL model is valid

type SQLParser

type SQLParser struct{}

SQLParser parses SQL external models

Jump to

Keyboard shortcuts

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