database

package
v1.9.15 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// DBType returns the name of the database as a string.
	DBType() string
	// Open opens the database.
	Open(path string) error
	// Close closes the database.
	Close() error
	// Size returns the size of the database.
	Size() int64
	// GC triggers a value log garbage collection.
	GC() error
	// Set adds a key-value pair to the database.
	Set(key, value string) error
	// Get gets the value of a key from the database.
	Get(key string) (string, error)
	// Del deletes a key from the database.
	Del(keys []string) error
	// HSet adds a key-value pair to a hashmap.
	HSet(hashmap, key, value string) error
	// HGet gets the value of a key from a hashmap.
	HGet(hashmap, key string) (string, error)
	// HDel deletes a key from a hashmap.
	HDel(hashmap string, keys []string) error
	// HGetAll gets all key-value pairs of a hashmap.
	HGetAll(hashmap string) (map[string]string, error)
	// HKeys gets all keys of a hashmap.
	HKeys(hashmap string) ([]string, error)
	// HLen gets the length of a hashmap.
	HLen(hashmap string) (int, error)
	// Iter iterates through stuff in the database.
	Iter(prefetch, includeOffset bool, offset, prefix string, handler func(key, value string) bool) error
}

Backend represents a database backend.

var Database Backend

Database holds the currently used database backend.

Directories

Path Synopsis
Package badger implements database backend based on badger.
Package badger implements database backend based on badger.

Jump to

Keyboard shortcuts

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