datasource

package
v0.3.17 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package datasource parses .datasource project files into model.Datasource values and persists them in the Redis-backed metadata registry (ADR 0001). The file format mirrors Tinybird's .datasource files byte-for-byte: a SCHEMA block of indented column lines followed by ENGINE/ENGINE_*/CONNECTOR directives (ADRs 0008, 0027).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(name, raw string) (*model.Datasource, error)

Parse parses raw .datasource text into a model.Datasource and runs structural + referential validation (ADR 0027). It does NOT validate ClickHouse types.

func ParseFile

func ParseFile(path string) (*model.Datasource, error)

ParseFile reads a .datasource file and parses it. The datasource name is the file basename without the .datasource extension.

Types

type Registry

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

Registry is a Redis-backed model.DatasourceRegistry. Each datasource is stored as JSON under "tr:ds:<name>".

func NewRegistry

func NewRegistry(rdb *redis.Client) *Registry

NewRegistry returns a Registry backed by rdb.

func (*Registry) Get

func (r *Registry) Get(ctx context.Context, name string) (*model.Datasource, bool, error)

Get returns the datasource named name. ok is false (with nil error) when no such key exists.

func (*Registry) List

func (r *Registry) List(ctx context.Context) ([]*model.Datasource, error)

List returns every stored datasource. Keys are discovered via SCAN (never KEYS — KEYS blocks the Redis event loop on large keyspaces).

func (*Registry) Put

func (r *Registry) Put(ctx context.Context, ds *model.Datasource) error

Put stores ds, overwriting any existing entry. No TTL: the registry is an AOF-persisted system of record (ADR 0001).

Jump to

Keyboard shortcuts

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