sprawl: github.com/sprawl/sprawl/db Index | Files

package db

import "github.com/sprawl/sprawl/db"

Index

Package Files

storage.go

type Storage Uses

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

Storage is a struct containing a database and its address

func (*Storage) Close Uses

func (storage *Storage) Close()

Close closes the underlying LevelDB connection

func (*Storage) Delete Uses

func (storage *Storage) Delete(key []byte) error

Delete uses LevelDB's Delete method to remove data from LevelDB

func (*Storage) DeleteAll Uses

func (storage *Storage) DeleteAll() error

DeleteAll deletes all entries from the database USE CAREFULLY

func (*Storage) DeleteAllWithPrefix Uses

func (storage *Storage) DeleteAllWithPrefix(prefix string) error

DeleteAllWithPrefix deletes all entries starting with a prefix

func (*Storage) Get Uses

func (storage *Storage) Get(key []byte) ([]byte, error)

Get uses LevelDB's method Get to fetch data from LevelDB

func (*Storage) GetAll Uses

func (storage *Storage) GetAll() (map[string]string, error)

GetAll returns all entries in the database regardless of key or prefix

func (*Storage) GetAllWithPrefix Uses

func (storage *Storage) GetAllWithPrefix(prefix string) (map[string]string, error)

GetAllWithPrefix returns all entries in the database with the specified prefix

func (*Storage) Has Uses

func (storage *Storage) Has(key []byte) (bool, error)

Has uses LevelDB's method Has to check does the data exists in LevelDB

func (*Storage) Put Uses

func (storage *Storage) Put(key []byte, data []byte) error

Put uses LevelDB's Put method to put data into LevelDB

func (*Storage) Run Uses

func (storage *Storage) Run() error

Run starts the database connection for Storage

func (*Storage) SetDbPath Uses

func (storage *Storage) SetDbPath(dbPath string)

SetDbPath sets the path the database files are located

Package db imports 3 packages (graph). Updated 2019-12-11. Refresh now. Tools for package owners.