memory

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package memory implements an in-memory, bitemporal key-value database. This is the reference implementation of bitempura.DB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB is an in-memory, bitemporal key-value database.

func NewDB

func NewDB(opts ...DBOpt) (*DB, error)

NewDB constructs a in-memory, bitemporal key-value database.

func (*DB) Delete

func (db *DB) Delete(key string, opts ...bt.WriteOpt) error

Delete removes value (with optional start and end valid time).

func (*DB) Get

func (db *DB) Get(key string, opts ...bt.ReadOpt) (*bt.VersionedKV, error)

Get data by key (as of optional valid and transaction times).

func (*DB) History

func (db *DB) History(key string) ([]*bt.VersionedKV, error)

History returns versions by descending end transaction time, descending end valid time

func (*DB) List

func (db *DB) List(opts ...bt.ReadOpt) ([]*bt.VersionedKV, error)

List all data (as of optional valid and transaction times).

func (*DB) Set

func (db *DB) Set(key string, value bt.Value, opts ...bt.WriteOpt) error

Set stores value (with optional start and end valid time).

type DBOpt added in v0.2.3

type DBOpt func(*dbOptions)

DBOpt is an option for constructing databases

func WithClock added in v0.2.3

func WithClock(clock bt.Clock) DBOpt

WithClock constructs database with a clock in order to control transaction times. This is used for testing.

func WithVersionedKVs added in v0.2.3

func WithVersionedKVs(versionedKVs []*bt.VersionedKV) DBOpt

WithVersionedKVs constructs database with seeded "versioned key-value" records. No two records for the same key may overlap both transaction time and valid time.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL