Help us shape the future of Go! Take the 2026 Go Developer Survey

connections

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package connections is the warehouses Brevis may reach, declared once.

THE ECOSYSTEM'S REGISTRY AND NOT THIS SERVICE'S. A client who taught the SDK to load into a warehouse has already said where that warehouse is; a second file saying it again for `/data` would be a second thing to keep right, and the one that drifts is the one nobody reads until a preview is empty. So the file is `brevis.yaml` at the project's root, `serve` reads it today, and the SDK and the gateway read it afterwards.

WHAT IT HOLDS AND WHAT IT NEVER HOLDS: a name, a dialect, and where to FIND a credential -- never the credential. `dsn_from` takes the NAME of an environment variable, which is the rule `--dsn-from` already follows and the gateway's own `dsn_from` before it. The file is in git; a password must not be.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Name    string `yaml:"name"`
	Dialect string `yaml:"dialect"`

	// Project is a BigQuery project id, which IS the connection there: ADC
	// does the rest and there is no DSN to hold.
	Project string `yaml:"project"`

	// DSNFrom is the NAME of the environment variable holding a connection
	// string. Never the string.
	DSNFrom string `yaml:"dsn_from"`
	// contains filtered or unexported fields
}

Connection is one declared warehouse.

type Registry

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

Registry is every connection, in the order they were declared.

func Load

func Load(path string) (*Registry, error)

Load reads the registry, or refuses it by name.

REFUSED AT BOOT AND NOT AT THE FIRST REQUEST. A service that accepted a broken declaration would answer a readiness probe and then fail the first person who opened a tab, which is a lie told to an orchestrator.

A FILE THAT IS NOT THERE IS NOT A FAILURE: `serve` with no registry is BigQuery-only, which is what V1 and V2 shipped, and refusing to start without a file nobody has written yet would be a service nobody can run.

func (*Registry) Match

func (r *Registry) Match(d, first string) (Connection, bool)

Match finds the connection a target names, and NOT FINDING ONE IS AN ANSWER. The screen has to say which connection is missing, and an error carries nothing to put on it.

func (*Registry) Names

func (r *Registry) Names() []string

Names lists the declared connections, for a refusal to name what there is.

func (*Registry) Open

func (r *Registry) Open(ctx context.Context, d, first string) (dialect.Conn, error)

Open connects to the warehouse a target names.

Jump to

Keyboard shortcuts

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