badger

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package badger implements database backend based on badger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Badger

type Badger struct {
	DB *badger.DB
}

Badger represents a badger database instance.

var Database Badger

Database is an instance of the database backend.

func (*Badger) Close

func (db *Badger) Close() error

Close closes the database.

func (*Badger) DBType

func (db *Badger) DBType() string

DBType returns the name of the database as a string.

func (*Badger) Del

func (db *Badger) Del(keys []string) error

Del deletes a key from the database.

func (*Badger) Get

func (db *Badger) Get(key string) (string, error)

Get gets the value of a key from the database.

func (*Badger) HDel

func (db *Badger) HDel(hashmap string, keys []string) error

HDel deletes a key from a hashmap.

func (*Badger) HGet

func (db *Badger) HGet(hashmap, key string) (string, error)

HGet gets the value of a key from a hashmap.

func (*Badger) HGetAll

func (db *Badger) HGetAll(hashmap string) (map[string]string, error)

HGetAll gets all key-value pairs of a hashmap.

func (*Badger) HKeys

func (db *Badger) HKeys(hashmap string) ([]string, error)

HKeys gets all keys of a hashmap.

func (*Badger) HLen

func (db *Badger) HLen(hashmap string) (int, error)

HLen gets the length of a hashmap.

func (*Badger) HSet

func (db *Badger) HSet(hashmap, key, value string) error

HSet adds a key-value pair to a hashmap.

func (*Badger) Iter

func (db *Badger) Iter(prefetch, includeOffset bool, offset, prefix string, handler func(key, value string) bool) error

Iter iterates through stuff in the database.

func (*Badger) Open

func (db *Badger) Open(path string) error

Open opens the database.

func (*Badger) Set

func (db *Badger) Set(key, value string) error

Set adds a key-value pair to the database.

func (*Badger) Size

func (db *Badger) Size() int64

Size returns the size of the database.

Jump to

Keyboard shortcuts

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