Documentation ¶
Index ¶
- Constants
- type BadgerDB
- func (b BadgerDB) Close() error
- func (b BadgerDB) GetDate(entry Entry) string
- func (b BadgerDB) GetKey(entry Entry) string
- func (b BadgerDB) Read(id string) (Entry, error)
- func (b BadgerDB) ReadIDList(date string) ([]string, error)
- func (b BadgerDB) ReadList(date string) ([]Entry, error)
- func (b BadgerDB) Write(entry Entry) error
- func (b BadgerDB) WriteList(entry Entry) error
- type BadgerDBUtils
- type BadgerDBUtilsDefault
- type DB
- type Entry
Constants ¶
View Source
const ( // EntryIDDateSeparator is used for separating date from the rest EntryIDDateSeparator = "_" // ErrReadPrefixText is used as prefix text for read errors ErrReadPrefixText = "Following errors occurred while reading the entries:" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadgerDB ¶
type BadgerDB struct {
// contains filtered or unexported fields
}
BadgerDB represents a Badger database
func GetBadgerDB ¶
func GetBadgerDB(location string, dbUtils BadgerDBUtils) (*BadgerDB, error)
GetBadgerDB returns a reference to BadgerDB struct
func (BadgerDB) ReadIDList ¶
ReadIDList retrieves list of IDs matching the given date
type BadgerDBUtils ¶
type BadgerDBUtils interface { Encode(Entry) ([]byte, error) Decode([]byte) (Entry, error) EncodeList([]Entry) ([]byte, error) DecodeList([]byte) ([]Entry, error) }
BadgerDBUtils represents functions required for calling DB functions
type BadgerDBUtilsDefault ¶
type BadgerDBUtilsDefault struct{}
BadgerDBUtilsDefault represents default implementation of BadgerDBUtils
func (BadgerDBUtilsDefault) Decode ¶
func (b BadgerDBUtilsDefault) Decode(value []byte) (Entry, error)
Decode returns entry after decoding the given value
func (BadgerDBUtilsDefault) DecodeList ¶
func (b BadgerDBUtilsDefault) DecodeList(value []byte) ([]Entry, error)
DecodeList returns entry after decoding the given value
func (BadgerDBUtilsDefault) Encode ¶
func (b BadgerDBUtilsDefault) Encode(entry Entry) ([]byte, error)
Encode returns encoded value of the given entry
func (BadgerDBUtilsDefault) EncodeList ¶
func (b BadgerDBUtilsDefault) EncodeList(entryList []Entry) ([]byte, error)
EncodeList returns encoded value of the given entry list
Click to show internal directories.
Click to hide internal directories.