db

package
v0.0.0-...-7ede18c Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoSuchKeyError   = errors.New("no such key in database")
	InvalidTypeError = errors.New("invalid result type")
)

Functions

func InitEKTDB

func InitEKTDB(filePath string)

Types

type ComposedKVDatabase

type ComposedKVDatabase struct {
	// contains filtered or unexported fields
}

func NewComposedKVDatabase

func NewComposedKVDatabase(filePath string) *ComposedKVDatabase

func (*ComposedKVDatabase) Delete

func (db *ComposedKVDatabase) Delete(key []byte) error

func (*ComposedKVDatabase) Get

func (db *ComposedKVDatabase) Get(key []byte) (value []byte, err error)

func (*ComposedKVDatabase) Set

func (db *ComposedKVDatabase) Set(key, value []byte) error

type IKVDatabase

type IKVDatabase interface {
	Set(key, value []byte) error
	Get(key []byte) ([]byte, error)
	Delete(key []byte) error
}
var EktDB IKVDatabase

func GetDBInst

func GetDBInst() IKVDatabase

type LevelDB

type LevelDB struct {
	DB *leveldb.DB
}

func NewLevelDB

func NewLevelDB(filePath string) *LevelDB

func (LevelDB) Delete

func (levelDB LevelDB) Delete(key []byte) error

func (LevelDB) Get

func (levelDB LevelDB) Get(key []byte) ([]byte, error)

func (LevelDB) Set

func (levelDB LevelDB) Set(key, value []byte) error

type MemKVDatabase

type MemKVDatabase struct {
	Map sync.Map
}

func NewMemKVDatabase

func NewMemKVDatabase() *MemKVDatabase

func (*MemKVDatabase) Delete

func (db *MemKVDatabase) Delete(key []byte) error

func (*MemKVDatabase) Get

func (db *MemKVDatabase) Get(key []byte) ([]byte, error)

func (*MemKVDatabase) Set

func (db *MemKVDatabase) Set(key, value []byte) error

type Sqlite

type Sqlite struct {
	DB *sql.DB
}

func NewSqlite

func NewSqlite(path string) (*Sqlite, error)

Jump to

Keyboard shortcuts

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