Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnyCreated ¶
type AnyCreated[T any] interface { // CreatedAt returns the creation time of the value. CreatedAt() time.Time }
AnyCreated is the interface for values where the creation time can be retrieved.
type History ¶
type History[T AnyCreated[T]] []T
History is a convenience type for storing a list of values, sorted by creation date in descendant order.
type StoreFilter ¶
type StoreFilter[T AnyCreated[T]] func(T) bool
StoreFilter defines a function to filter values in the store.
type StoreReducer ¶
type StoreReducer[T AnyCreated[T]] func(T)
StoreReducer defines a function to manipulate values in the store.
type Storer ¶
type Storer[T AnyCreated[T]] interface { // Add appends a new value to the store. Add(string, T) // Get returns a value from the store by the identifier it was stored with. Get(string) T // Delete removes a value from the store by the identifier it was stored with. Delete(string) // List returns a list of values from the store. List() []T // Size returns the number of values in the store. Size() int // First returns the first value found in the store by a given filter. First(StoreFilter[T]) T // ApplyAll calls the reducer function with every value in the store. ApplyAll(StoreReducer[T]) }
Storer defines an interface that any store must implement.
Click to show internal directories.
Click to hide internal directories.