Documentation ¶
Index ¶
- Variables
- func Close() (err error)
- func Connect(path string, readonly bool) (err error)
- func Delete(m Model) (err error)
- func Get(key []byte, m Model) (err error)
- func LastServiceStatus(id uuid.UUID, m Model) (err error)
- func NewIterator(slice *util.Range) iterator.Iterator
- func Put(m Model) (err error)
- type Model
- type Transaction
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotConnected = errors.New("not connected to the database") ErrNotFound = errors.New("record not found") )
var KeyCurrentStatus = []byte{0, 0, 0, 0, 0, 0, 114, 111, 116, 97, 116, 105, 111, 110, 97, 108}
Functions ¶
func LastServiceStatus ¶
Because service status keys are ordered by time using ULIDs, it is possible to fetch the last service status for a service ID by using the ID as a prefix to iterate over the keys and return the last item; unmarshaling it into the specified model.
func NewIterator ¶
Create a new iterator - note that it is possible to close the DB connection during iteration, which will cause the iterator to return a leveldb.ErrClosed error.
Types ¶
type Transaction ¶
type Transaction struct {
leveldb.Transaction
}
func BeginTx ¶
func BeginTx() (_ *Transaction, err error)
OpenTransaction opens an atomic DB transaction. Only one transaction can be opened at a time. Subsequent call to Write and OpenTransaction will be blocked until in-flight transaction is committed or discarded. The returned transaction handle is safe for concurrent use.
func (*Transaction) Delete ¶
func (t *Transaction) Delete(m Model) (err error)
func (*Transaction) NewIterator ¶
func (t *Transaction) NewIterator(slice *util.Range) iterator.Iterator
func (*Transaction) Put ¶
func (t *Transaction) Put(m Model) (err error)