Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	Db map[string]string
}

    Storage is a struct containing a database and its address

    func (*Storage) Close

    func (storage *Storage) Close()

      Close closes the underlying LevelDB connection

      func (*Storage) Delete

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

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

        func (*Storage) DeleteAll

        func (storage *Storage) DeleteAll() error

          DeleteAll deletes all entries from the database USE CAREFULLY

          func (*Storage) DeleteAllWithPrefix

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

            DeleteAllWithPrefix deletes all entries starting with a prefix

            func (*Storage) Get

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

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

              func (*Storage) GetAll

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

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

                func (*Storage) GetAllWithPrefix

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

                  GetAllWithPrefix returns all entries in the database with the specified prefix

                  func (*Storage) Has

                  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

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

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

                      func (*Storage) Run

                      func (storage *Storage) Run() error

                        Run starts the database connection for Storage

                        func (*Storage) SetDbPath

                        func (storage *Storage) SetDbPath(dbPath string)

                          SetDbPath sets the path the database files are located