backends

package
v0.0.0-...-41849fc Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package backends resolves declarative index/query strategies independently of their database drivers. Built-ins are embedded so binaries are portable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultNames

func DefaultNames() []string

DefaultNames preserves the loader's historical default targets. Each name must resolve to a backend manifest; registering a driver never adds a target.

Types

type Backend

type Backend struct {
	Manifest
	Name string
}

func Builtin

func Builtin(name string) (Backend, error)

Builtin reads only the embedded manifest, including for historical dashboard recordings that must not depend on local overrides.

func Resolve

func Resolve(name, dataset, dir string) (Backend, error)

Resolve uses an external global manifest (if present), otherwise an embedded manifest. A registered driver alone is never a backend. The optional dataset manifest replaces whole top-level fields, including extras; it does not merge nested lists. dir defaults to ./backends; an explicitly supplied directory must exist.

func (Backend) CLILoader

func (w Backend) CLILoader(connection string) (*drivers.CLILoader, error)

func (Backend) ConfigureDriver

func (w Backend) ConfigureDriver(driver drivers.Driver)

ConfigureDriver applies PostgreSQL backend capture and telemetry settings.

func (Backend) ContainerName

func (w Backend) ContainerName() string

func (Backend) DriverConfig

func (w Backend) DriverConfig() (drivers.DriverConfig, error)

func (Backend) EnvironmentVariable

func (w Backend) EnvironmentVariable() string

func (Backend) NewDriver

func (w Backend) NewDriver(connection string) (drivers.Driver, error)

func (Backend) ResolveConnection

func (w Backend) ResolveConnection(explicit string) (string, error)

ResolveConnection gives explicit configuration precedence over environment and manifest defaults. Drivers that support connection-free configuration may resolve their own endpoint (for example, Turbopuffer region settings).

type Extras

type Extras struct {
	GUCs        []string `yaml:"gucs"`
	GUCPrefixes []string `yaml:"gucPrefixes"`
	Queries     []Query  `yaml:"queries"`
	// When present, replace the driver's index-I/O access methods while keeping
	// its standard PostgreSQL telemetry. An empty list disables index I/O only.
	IndexAccessMethods []string `yaml:"indexAccessMethods"`
}

type Manifest

type Manifest struct {
	DriverName  string  `yaml:"driver"`
	Container   *string `yaml:"container"`
	Connection  string  `yaml:"connection"`
	EnvVar      *string `yaml:"envVar"`
	Description string  `yaml:"description"`
	Color       string  `yaml:"color"`
	Extras      Extras  `yaml:"extras,omitempty"`
}

type Query

type Query struct {
	Key string `yaml:"key"`
	SQL string `yaml:"query"`
}

Query accepts either SQL (the result column supplies its key), or a mapping with an explicit key for compatibility with existing config captures.

func (*Query) UnmarshalYAML

func (q *Query) UnmarshalYAML(n *yaml.Node) error

Jump to

Keyboard shortcuts

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