Documentation ¶
Index ¶
- func Drivers() []string
- func Open(sp view.ServiceProvider, driverName, dataSourceName string, config Config) (driver.Persistence, error)
- func OpenVersioned(sp view.ServiceProvider, driverName, dataSourceName string, config Config) (driver.VersionedPersistence, error)
- func Register(name string, driver driver.Driver)
- func Unversioned(store driver.VersionedPersistence) driver.Persistence
- type Config
- type PrefixConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Drivers ¶
func Drivers() []string
Drivers returns a sorted list of the names of the registered drivers.
func Open ¶
func Open(sp view.ServiceProvider, driverName, dataSourceName string, config Config) (driver.Persistence, error)
Open returns a new persistence handle. Similarly to database/sql: driverName is a string that describes the driver dataSourceName describes the data source in a driver-specific format. The returned connection is only used by one goroutine at a time.
func OpenVersioned ¶
func OpenVersioned(sp view.ServiceProvider, driverName, dataSourceName string, config Config) (driver.VersionedPersistence, error)
OpenVersioned returns a new *versioned* persistence handle. Similarly to database/sql: driverName is a string that describes the driver dataSourceName describes the data source in a driver-specific format. The returned connection is only used by one goroutine at a time.
func Register ¶
Register makes a db driver available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.
func Unversioned ¶
func Unversioned(store driver.VersionedPersistence) driver.Persistence
Unversioned returns the unversioned persistence from the supplied versioned one
Types ¶
type Config ¶
type Config interface { // UnmarshalKey takes a single key and unmarshals it into a Struct UnmarshalKey(key string, rawVal interface{}) error }
Config models the DB configuration
type PrefixConfig ¶
type PrefixConfig struct {
// contains filtered or unexported fields
}
PrefixConfig extends Config by adding a given prefix to any passed key
func NewPrefixConfig ¶
func NewPrefixConfig(config Config, prefix string) *PrefixConfig
NewPrefixConfig returns a ner PrefixConfig instance for the passed prefix
func (*PrefixConfig) UnmarshalKey ¶
func (c *PrefixConfig) UnmarshalKey(key string, rawVal interface{}) error
UnmarshalKey takes a single key, appends to it the prefix set in the struct, and unmarshals it into a Struct
Directories ¶
Path | Synopsis |
---|---|
badger/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
unversioned/mocks
Code generated by counterfeiter.
|
Code generated by counterfeiter. |