Documentation
¶
Index ¶
- type Database
- type Snapshot
- func (s *Snapshot) Ascend(ctx context.Context, begin, end string, errp *error) iter.Seq2[string, io.Reader]
- func (s *Snapshot) Descend(ctx context.Context, begin, end string, errp *error) iter.Seq2[string, io.Reader]
- func (s *Snapshot) Discard(ctx context.Context) error
- func (s *Snapshot) Get(ctx context.Context, key string) (io.Reader, error)
- func (s *Snapshot) Scan(ctx context.Context, errp *error) iter.Seq2[string, io.Reader]
- type Transaction
- func (t *Transaction) Ascend(ctx context.Context, begin, end string, errp *error) iter.Seq2[string, io.Reader]
- func (t *Transaction) Commit(ctx context.Context) error
- func (t *Transaction) Delete(ctx context.Context, key string) error
- func (t *Transaction) Descend(ctx context.Context, begin, end string, errp *error) iter.Seq2[string, io.Reader]
- func (t *Transaction) Get(ctx context.Context, key string) (io.Reader, error)
- func (t *Transaction) Rollback(ctx context.Context) error
- func (t *Transaction) Scan(ctx context.Context, errp *error) iter.Seq2[string, io.Reader]
- func (t *Transaction) Set(ctx context.Context, key string, value io.Reader) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) NewSnapshot ¶
NewSnapshot creates a read-only snapshot of the database.
func (*Database) NewTransaction ¶
func (d *Database) NewTransaction(ctx context.Context) (*Transaction, error)
NewTransaction creates a read-write transaction on the database.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
func (*Snapshot) Ascend ¶
func (s *Snapshot) Ascend(ctx context.Context, begin, end string, errp *error) iter.Seq2[string, io.Reader]
Ascend implements kv.Scanner interface to range over key-value pairs between 'begin' and 'end' keys in the database in ascending order.
func (*Snapshot) Descend ¶
func (s *Snapshot) Descend(ctx context.Context, begin, end string, errp *error) iter.Seq2[string, io.Reader]
Ascend implements kv.Scanner interface to range over key-value pairs between 'begin' and 'end' keys in the database in descending order.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func (*Transaction) Ascend ¶
func (t *Transaction) Ascend(ctx context.Context, begin, end string, errp *error) iter.Seq2[string, io.Reader]
Ascend implements kv.Scanner interface to range over key-value pairs between 'begin' and 'end' keys in the database in ascending order.
func (*Transaction) Commit ¶
func (t *Transaction) Commit(ctx context.Context) error
Commit attempts to save all updates performed by the transaction to the database. Returns nil on success. Transaction is effectively destroyed irrespective of the result and no operations should be performed any further.
func (*Transaction) Delete ¶
func (t *Transaction) Delete(ctx context.Context, key string) error
Delete removes the input key and the associated value. Returns nil even when the input key doesn't exist.
func (*Transaction) Descend ¶
func (t *Transaction) Descend(ctx context.Context, begin, end string, errp *error) iter.Seq2[string, io.Reader]
Ascend implements kv.Scanner interface to range over key-value pairs between 'begin' and 'end' keys in the database in descending order.
func (*Transaction) Get ¶
Get returns the value associated with the input key. Returns os.ErrNotExist if key was deleted or doesn't exist.
func (*Transaction) Rollback ¶
func (t *Transaction) Rollback(ctx context.Context) error
Rollback drops all updates performed by the transaction. Transaction is effectively destroyed and no operations should be performed any further.