Documentation
¶
Overview ¶
Package bitempura contains experiments with bitemporal data. It defines an interface for bitemporal key-value databases.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface {
// Get data by key (as of optional valid and transaction times).
Get(key string, opts ...ReadOpt) (*VersionedKV, error)
// List all data (as of optional valid and transaction times).
List(opts ...ReadOpt) ([]*VersionedKV, error)
// Set stores value (with optional start and end valid time).
Set(key string, value Value, opts ...WriteOpt) error
// Delete removes value (with optional start and end valid time).
Delete(key string, opts ...WriteOpt) error
// History returns all versioned key-values for key by descending end transaction time, descending end valid time.
History(key string) ([]*VersionedKV, error)
}
DB for bitemporal data.
Temporal control options. ReadOpt's: AsOfValidTime, AsOfTransactionTime. WriteOpt's: WithValidTime, WithEndValidTime.
type ReadOpt ¶
type ReadOpt func(*ReadOptions)
ReadOpt is an option for database reads
func AsOfTransactionTime ¶
AsOfTransactionTime allows reader to read as of a specified transaction time
func AsOfValidTime ¶
AsOfValidTime allows reader to read as of a specified valid time
type Value ¶
type Value interface{}
Value is the user-controlled data associated with a key (and valid and transaction time information) in the database.
type VersionedKV ¶
type VersionedKV struct {
Key string
Value Value
TxTimeStart time.Time // inclusive
TxTimeEnd *time.Time // exclusive
ValidTimeStart time.Time // inclusive
ValidTimeEnd *time.Time // exclusive
}
VersionedKV is a transaction time and valid time versioned key-value. Transaction and valid time starts are inclusive and ends are exclusive. No two VersionedKVs for the same key can overlap both transaction time and valid time.
func (*VersionedKV) Validate ¶
func (d *VersionedKV) Validate() error
Validate a versioned key-value
type WriteOpt ¶
type WriteOpt func(*WriteOptions)
WriteOpt is an option for database writes
func WithEndValidTime ¶
WithEndValidTime allows writer to configure explicit end valid time
func WithValidTime ¶
WithValidTime allows writer to configure explicit valid time