sql

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 12 Imported by: 0 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SourceID        string            `json:"source_id" yaml:"source_id"`
	Driver          string            `json:"driver" yaml:"driver"`
	DSN             string            `json:"dsn" yaml:"dsn"`
	Mode            string            `json:"mode" yaml:"mode"` // "batch" or "stream"
	Query           string            `json:"query" yaml:"query"`
	StreamingQuery  string            `json:"stream_query" yaml:"stream_query"`
	Table           string            `json:"table" yaml:"table"`
	WatermarkColumn string            `json:"watermark_column" yaml:"watermark_column"`
	StartWatermark  string            `json:"start_watermark" yaml:"start_watermark"`
	WatermarkType   string            `json:"watermark_type" yaml:"watermark_type"` // "string", "int", "float", "time"
	PollInterval    time.Duration     `json:"poll_interval" yaml:"poll_interval"`
	MaxRows         int               `json:"max_rows" yaml:"max_rows"`
	SchemaName      string            `json:"schema_name" yaml:"schema_name"`
	SchemaVersion   string            `json:"schema_version" yaml:"schema_version"`
	SourceKey       string            `json:"source_key" yaml:"source_key"`
	Timeout         time.Duration     `json:"timeout" yaml:"timeout"`
	ColumnMapping   map[string]string `json:"column_mapping" yaml:"column_mapping"`
}

Config holds SQL source configuration.

type Factory

type Factory struct{}

Factory for SQL sources.

func (*Factory) Create

func (f *Factory) Create(config adapters.SourceConfig) (adapters.FactSource, error)

func (*Factory) GetConfigSchema

func (f *Factory) GetConfigSchema() adapters.ConfigSchema

func (*Factory) ValidateConfig

func (f *Factory) ValidateConfig(config adapters.SourceConfig) error

type SchemaConfig

type SchemaConfig struct {
	Driver        string            `json:"driver" yaml:"driver"`
	DSN           string            `json:"dsn" yaml:"dsn"`
	Table         string            `json:"table" yaml:"table"`
	Schema        string            `json:"schema" yaml:"schema"`
	Catalog       string            `json:"catalog" yaml:"catalog"`
	SchemaName    string            `json:"schema_name" yaml:"schema_name"`
	SchemaVersion string            `json:"schema_version" yaml:"schema_version"`
	IncludeCols   []string          `json:"include_columns" yaml:"include_columns"`
	ExcludeCols   []string          `json:"exclude_columns" yaml:"exclude_columns"`
	ColumnMapping map[string]string `json:"column_mapping" yaml:"column_mapping"`
}

SchemaConfig controls SQL schema introspection.

type SchemaFactory

type SchemaFactory struct{}

SchemaFactory creates SQL schema providers.

func (*SchemaFactory) Create

func (*SchemaFactory) GetConfigSchema

func (f *SchemaFactory) GetConfigSchema() adapters.ConfigSchema

func (*SchemaFactory) ValidateConfig

func (f *SchemaFactory) ValidateConfig(config adapters.SchemaSourceConfig) error

type SchemaProvider

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

SchemaProvider introspects SQL tables into JSON schema definitions.

func (*SchemaProvider) Close

func (p *SchemaProvider) Close() error

func (*SchemaProvider) LoadSchemas

func (p *SchemaProvider) LoadSchemas(ctx context.Context) ([]adapters.SchemaDefinition, error)

type Source

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

Source implements a generic SQL fact source with batch or streaming modes.

func NewSource

func NewSource(config *Config) (*Source, error)

NewSource creates a new SQL source.

func (*Source) GetMetadata

func (s *Source) GetMetadata() adapters.SourceMetadata

GetMetadata returns source metadata.

func (*Source) GetSourceSchema

func (s *Source) GetSourceSchema() *adapters.Schema

GetSourceSchema returns schema metadata.

func (*Source) HealthCheck

func (s *Source) HealthCheck() error

HealthCheck checks DB connectivity.

func (*Source) Start

func (s *Source) Start(ctx context.Context) error

Start opens the SQL connection.

func (*Source) Stop

func (s *Source) Stop(ctx context.Context) error

Stop stops the source.

func (*Source) Subscribe

func (s *Source) Subscribe(ctx context.Context, factTypes []string) (<-chan *adapters.TypedFact, error)

Subscribe starts polling rows from the SQL source.

Jump to

Keyboard shortcuts

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