db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database added in v0.1.0

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

func GetInstance deprecated

func GetInstance() *Database

Deprecated: The db implementation was designed to be a Singleton However, this need to be a client rules, so we need to give the possibility to build an instance with `NewInstance` method and if the client want to use the Singleton pattern it need to implement the pattern.

func NewInstance added in v0.1.0

func NewInstance(homeDir string) (*Database, error)

func (*Database) CloseDatabase added in v0.1.0

func (this *Database) CloseDatabase() error

Close connection with the database

func (*Database) DeleteValue added in v0.1.0

func (this *Database) DeleteValue(key string) error

Delete value with the specified key

func (*Database) EraseAfterCloseDatabse added in v0.1.0

func (this *Database) EraseAfterCloseDatabse() error

Close and erase the database

func (*Database) EraseDatabase added in v0.1.0

func (this *Database) EraseDatabase() error

Erase the root of the database

func (*Database) GetRawIterator added in v0.1.0

func (this *Database) GetRawIterator() iterator.Iterator

Take as result the raw iterator to iterate over the database content The user need to take kare of the Release at the end of the usage

func (*Database) GetValue added in v0.1.0

func (this *Database) GetValue(key string) (string, error)

Get a value as string with the specified key, or return a not nil error in case of error.

func (*Database) GetValueInBytes added in v0.1.0

func (this *Database) GetValueInBytes(key string) ([]byte, error)

Get a value as bytes with the specified key, or return a not nil error.

func (*Database) InitDB added in v0.1.0

func (this *Database) InitDB(homedir string) error

func (*Database) IterateFrom added in v0.1.0

func (this *Database) IterateFrom(startKey string, callback func(string) error) error

Iterate through the index from startKey, and run the callback specified by the user, a not nil value is returned if any error occurs.

func (*Database) IterateThrough added in v0.1.0

func (this *Database) IterateThrough(startKey string, endKey string, callback func(string) error) error

Iterate through the index from startKey included to endKey not included, and execute the callback defined from the user.

func (*Database) ListOfKeys added in v0.1.0

func (this *Database) ListOfKeys() ([]*string, error)

Take as result the list of keys that are in the stored in the database

func (*Database) PutValue added in v0.1.0

func (this *Database) PutValue(key string, value string) error

Put a string value in the db with the specified key

func (*Database) PutValueInBytes added in v0.1.0

func (this *Database) PutValueInBytes(key string, value []byte) error

Put a value defined in bytes in the db with the specified key

func (*Database) Ready added in v0.1.0

func (this *Database) Ready() bool

Jump to

Keyboard shortcuts

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