virtual

package
v0.1.110 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 4 Imported by: ? 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

Overview

Package virtual is a registry of connections a host answers from its own configuration rather than from stored rows: connection://<namespace>/<name> references resolved per request, any of which can be the default a profile with no connection of its own runs against.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	// Reference is the connection://<namespace>/<name> the entry answers.
	Reference string
	// Type is the models.ConnectionType* of the connection Resolve returns.
	Type string
	// Default makes the entry the connection a provider that can use Type runs
	// against when its profile names none. At most one entry per Type.
	Default bool
	// Resolve answers the connection for the request ctx carries.
	Resolve func(ctx dbcontext.Context) (*models.Connection, error)
}

Entry is one virtual connection.

type Registry

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

Registry is a set of virtual connections.

func New

func New(entries ...Entry) (*Registry, error)

New validates entries: each needs a reference, a type and a Resolve, no two may share a reference, and no two defaults may share a type.

func (*Registry) Attach

func (r *Registry) Attach(ctx dbcontext.Context) dbcontext.Context

Attach makes ctx resolve the registry's references, passing every other one to the resolver ctx already had, and default a provider with no connection to the registry's default for a type it can use.

Jump to

Keyboard shortcuts

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