database

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider manages the lifecycle of database instances. It uses lazy-loading with sync.Once to ensure instances are created only when needed and in a concurrency-safe manner.

func NewProvider

func NewProvider(logger runtimelog.Logger) *Provider

NewProvider creates a new, uninitialized Provider instance.

func (*Provider) Database

func (p *Provider) Database(name string) (storageiface.Database, error)

Database returns a single database instance by name.

func (*Provider) Databases

func (p *Provider) Databases() (map[string]storageiface.Database, error)

Databases returns a map of all available database instances. On the first call, it lazily creates and caches instances based on the configuration.

func (*Provider) DefaultDatabase

func (p *Provider) DefaultDatabase(globalDefaultName string) (storageiface.Database, error)

DefaultDatabase returns the default database instance.

func (*Provider) Initialize

func (p *Provider) Initialize(cfg *datav1.Databases, opts ...options.Option)

Initialize configures the provider with the necessary configuration and options.

func (*Provider) RegisterDatabase

func (p *Provider) RegisterDatabase(name string, db storageiface.Database)

RegisterDatabase allows for manual registration of a database instance.

Jump to

Keyboard shortcuts

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