factory

package
v1.20.4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: BSD-3-Clause Imports: 11 Imported by: 6 modules, 11 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvailableDatabases added in v1.2.14

func AvailableDatabases() []string

AvailableDatabases returns the list of available database types

func New

func New(
	name string,
	dbPath string,
	readOnly bool,
	config []byte,
	gatherer interface{},
	logger log.Logger,
	metricsPrefix string,
	meterDBRegName string,
) (database.Database, error)

New creates a new database with the provided configuration

func NewFromConfig added in v1.0.3

func NewFromConfig(cfg DatabaseConfig) (database.Database, error)

NewFromConfig creates a new database from a DatabaseConfig

func RegisterDatabase added in v1.2.14

func RegisterDatabase(name string, factory DatabaseFactory)

RegisterDatabase registers a database factory for a given name

Types

type DatabaseConfig added in v1.0.3

type DatabaseConfig struct {
	Type           string
	Dir            string
	Name           string
	ReadOnly       bool
	Config         []byte
	MetricsReg     metric.Registerer
	Logger         log.Logger
	MetricsPrefix  string
	MeterDBRegName string
}

DatabaseConfig is a convenience struct for database configuration

type DatabaseFactory added in v1.2.14

type DatabaseFactory func(
	dbPath string,
	config []byte,
	logger log.Logger,
	registerer metric.Registerer,
	metricsPrefix string,
	readOnly bool,
) (database.Database, error)

DatabaseFactory is a function that creates a database

Jump to

Keyboard shortcuts

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