database

package
v0.0.0-...-93e21f3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoConfig = errors.New("no database configuration")

Functions

func NewInventoryConfigs

func NewInventoryConfigs() map[string]Config

func NewNonceCheckerConfigs

func NewNonceCheckerConfigs() map[string]Config

func NewSourceCacheConfigs

func NewSourceCacheConfigs() map[string]Config

Types

type Adapter

type Adapter struct {
	Name             string
	NewConfig        func() Config
	Open             func(Config) (Endpoint, error)
	InitInventory    func(Context, Endpoint) (model.Inventory, error)
	InitSourceCache  func(Context, Endpoint) (model.SourceCache, error)
	InitNonceChecker func(Context, Endpoint) (model.NonceChecker, error)
}

func Register

func Register(a *Adapter) *Adapter

func (*Adapter) String

func (a *Adapter) String() string

type Config

type Config interface {
	Enabled() bool
	Equal(Config) bool
}

type DB

type DB struct {
	Adapter *Adapter
	Config  Config
	// contains filtered or unexported fields
}

func Open

func Open(name string, config Config) (*DB, error)

func Resolve

func Resolve(configs map[string]Config) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) InitInventory

func (db *DB) InitInventory(ctx Context) (model.Inventory, error)

func (*DB) InitNonceChecker

func (db *DB) InitNonceChecker(ctx Context) (model.NonceChecker, error)

func (*DB) InitSourceCache

func (db *DB) InitSourceCache(ctx Context) (model.SourceCache, error)

type Endpoint

type Endpoint interface {
	io.Closer
}

Directories

Path Synopsis
Package sql implements server model interfaces.
Package sql implements server model interfaces.

Jump to

Keyboard shortcuts

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