Documentation
¶
Overview ¶
Package bunt provides BuntDB connection helpers.
New code should pass explicit configuration or an explicit environment prefix:
import "github.com/InsideGallery/core/db/bunt"
db, err := bunt.Open(&bunt.ConnectionConfig{Filename: ":memory:"})
Compatibility: GetConnection remains available for consumers that still rely on the default DB environment prefix. Prefer Open or OpenFromEnv so ownership of configuration is visible at the call site.
Index ¶
Constants ¶
const EncPrefixDB = "DB"
EncPrefixDB contains profix of DB
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionConfig ¶
type ConnectionConfig struct {
Filename string `env:"_FILENAME" envDefault:":memory:"`
}
ConnectionConfig contains listen url for the server and additional options
func GetConnectionConfigFromEnv ¶
func GetConnectionConfigFromEnv(prefix string) (*ConnectionConfig, error)
GetConnectionConfigFromEnv return server configs bases on environment variables
type Wrapper ¶
Wrapper wrapper of buntdb
func GetConnection
deprecated
func Open ¶ added in v1.1.0
func Open(config *ConnectionConfig) (*Wrapper, error)
Open creates a BuntDB wrapper from explicit config.
func OpenFromEnv ¶ added in v1.1.0
OpenFromEnv creates a BuntDB wrapper from an explicit environment prefix.