Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event[Model any] interface { Validate(Model) error Execute(Model, time.Time) Model Name() string }
Event is a set of functions that can modify a model.
type FileDB ¶
type FileDB struct {
File string
}
FileDB is a evet database based of one file.
type JSONDuration ¶
JSONDuration is a duration type with a consum marshaling to json.
func (JSONDuration) MarshalJSON ¶
func (d JSONDuration) MarshalJSON() ([]byte, error)
MarshalJSON converts the value to json.
func (*JSONDuration) UnmarshalJSON ¶
func (d *JSONDuration) UnmarshalJSON(bs []byte) error
UnmarshalJSON converts the time from json.
type JSONTime ¶
JSONTime is a time type that can be converted to json.
func (JSONTime) MarshalJSON ¶
MarshalJSON converts the value to json.
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON converts the time from json.
type MemoryDB ¶
type MemoryDB struct {
Content string
}
MemoryDB stores Events in memory.
Usefull for testing.
type Sticky ¶
type Sticky[Model any] struct { // contains filtered or unexported fields }
Sticky is some sort of db that persists a model on disk in a event storage way.
func New ¶
func New[Model any](db database, emptyModel Model, getEvent func(name string) Event[Model], os ...Option[Model]) (*Sticky[Model], error)
New initializes a new Sticky instance.
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
ValidationError happens, when the event can not be validated.
func (ValidationError) Error ¶
func (err ValidationError) Error() string
func (ValidationError) Unwrap ¶
func (err ValidationError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.