bunt

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

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

View Source
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

type Wrapper struct {
	*buntdb.DB
}

Wrapper wrapper of buntdb

func GetConnection deprecated

func GetConnection() (*Wrapper, error)

GetConnection return new connection to buntdb

Deprecated: use Open or OpenFromEnv with explicit config ownership.

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

func OpenFromEnv(prefix string) (*Wrapper, error)

OpenFromEnv creates a BuntDB wrapper from an explicit environment prefix.

func (*Wrapper) Get

func (w *Wrapper) Get(name string, value interface{}) error

Get get value by key

func (*Wrapper) Set

func (w *Wrapper) Set(name string, value interface{}) error

Set set value by key

Jump to

Keyboard shortcuts

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