Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection interface { Get(key []byte) (value []byte, err error) Set(key, value []byte) error Has(key []byte) (bool, error) }
Collection defines an embedded key/value store database interface. we could think of the Collection as a SQL table name or a mongodb collection name
type DB ¶
type DB interface { CreateNsCollection(ns string) Collection Close() error }
func NewBadgerDB ¶
func NewBadgerDB(kvOpts ...KvDBOption) (DB, error)
NewBadgerDB returns a new initialized badgerDB database implementing the DB interface. If the database cannot be initialized, an error will be returned.
type KvDBOption ¶
type KvDBOption func(*rootConfig) error
func WithDataDir ¶
func WithDataDir(dir string) KvDBOption
WithDataDir sets the data directory for the badgerDB database.
func WithGcDiscardRatio ¶
func WithGcDiscardRatio(ratio float64) KvDBOption
WithGcDiscardRatio sets the garbage collection discard ratio for the badgerDB database.
func WithGcInterval ¶
func WithGcInterval(interval time.Duration) KvDBOption
WithGcInterval sets the garbage collection interval for the badgerDB database.
func WithLogger ¶
func WithLogger(logger zerolog.Logger) KvDBOption
WithLogger sets the logger for the badgerDB database.
Click to show internal directories.
Click to hide internal directories.