Documentation
¶
Index ¶
- func Debug() bool
- func Type(data any) reflect.Kind
- type Content
- type List
- type Portions
- type Snapshot
- type Store
- func (s *Store[Key, Value]) Delete(key Key) bool
- func (s *Store[Key, Value]) Export() *Snapshot
- func (s *Store[Key, Value]) Get(key Key) (Value, bool)
- func (s *Store[Key, Value]) GetBool(key Key) bool
- func (s *Store[Key, Value]) GetBools(key Key) []bool
- func (s *Store[Key, Value]) GetByte(key Key) byte
- func (s *Store[Key, Value]) GetBytes(key Key) []byte
- func (s *Store[Key, Value]) GetFloat64(key Key) float64
- func (s *Store[Key, Value]) GetFloat64s(key Key) []float64
- func (s *Store[Key, Value]) GetInt(key Key) int
- func (s *Store[Key, Value]) GetInt64(key Key) int64
- func (s *Store[Key, Value]) GetInt64s(key Key) []int64
- func (s *Store[Key, Value]) GetInts(key Key) []int
- func (s *Store[Key, Value]) GetString(key Key) string
- func (s *Store[Key, Value]) GetStrings(key Key) []string
- func (s *Store[Key, Value]) Import(snap *Snapshot) *Store[Key, Value]
- func (s *Store[Key, Value]) List() List[Key]
- func (s *Store[Key, Value]) Set(key, data any) (bool, error)
- func (s *Store[Key, Value]) State(key Key) (time.Time, bool)
- func (s *Store[Key, Value]) Wipe() bool
- func (s *Store[Key, Value]) WithPortions(p Portions) *Store[Key, Value]
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
type Store[Key comparable, Value any] struct { // Logger adds a prefix of "store: " by default. Logger *log.Logger // contains filtered or unexported fields }
Store is the main datatype that holds runtime.
func New ¶
func New[Key comparable, Value any]() *Store[Key, Value]
New creates a new instance of store.
func (*Store[Key, Value]) Delete ¶
Delete removes the item called by the given key and return true if the key existed.
func (*Store[Key, Value]) Get ¶
Get looks up items by the given key and returns the data and a found boolean.
func (*Store[Key, Value]) GetBool ¶
GetBool looks up items by the given key and returns the data as boolean.
func (*Store[Key, Value]) GetBools ¶
GetBools looks up items by the given key and returns the data as []bool.
func (*Store[Key, Value]) GetByte ¶
GetByte looks up items by the given key and returns the data as byte.
func (*Store[Key, Value]) GetBytes ¶
GetBytes looks up items by the given key and returns the data as []byte.
func (*Store[Key, Value]) GetFloat64 ¶
GetFloat64 looks up items by the given key and returns the data as float64.
func (*Store[Key, Value]) GetFloat64s ¶
GetFloat64s looks up items by the given key and returns the data as []float64.
func (*Store[Key, Value]) GetInt ¶
GetInt looks up items by the given key and returns the data as int.
func (*Store[Key, Value]) GetInt64 ¶
GetInt64 looks up items by the given key and returns the data as int64.
func (*Store[Key, Value]) GetInt64s ¶
GetInt64s looks up items by the given key and returns the data as []int64.
func (*Store[Key, Value]) GetInts ¶
GetInts looks up items by the given key and returns the data as []int.
func (*Store[Key, Value]) GetString ¶
GetString looks up items by the given key and returns the data as string.
func (*Store[Key, Value]) GetStrings ¶
GetStrings looks up items by the given key and returns the data as []string.
func (*Store[Key, Value]) List ¶
List returns all keys with corresponding last change date values in the store.
func (*Store[Key, Value]) Set ¶
Set adds a new or overwrites an existing item in the store with the given key and data and returns the boolean value of replace.
func (*Store[Key, Value]) State ¶
State looks up the item by the given key and returns the change date and a found boolean.
func (*Store[Key, Value]) WithPortions ¶
WithPortions replaces the default Portions function with p if this call comes to an empty store.
type Summary ¶
type Summary[Key comparable] struct { Key Key Date time.Time }