Documentation ¶
Index ¶
- Variables
- type Key
- type Meta
- type Storage
- func (s Storage) Delete(ctx context.Context, key Key) error
- func (s Storage) Get(ctx context.Context, key Key, target any) error
- func (s Storage) GetAll(ctx context.Context, key Key, target func(index, total int) any) error
- func (s Storage) Purge(ctx context.Context) error
- func (s Storage) Set(ctx context.Context, key Key, value any) error
- func (s Storage) SetAll(ctx context.Context, key Key, values ...any) error
- type TypedKey
- func (f TypedKey[Value]) Delete(ctx context.Context, m *Storage) error
- func (f TypedKey[Value]) Get(ctx context.Context, s *Storage) (value Value, err error)
- func (f TypedKey[Value]) GetAll(ctx context.Context, m *Storage) (values []Value, err error)
- func (f TypedKey[Value]) GetOrSet(ctx context.Context, s *Storage, dflt Value) (value Value, err error)
- func (f TypedKey[Value]) Set(ctx context.Context, m *Storage, value Value) error
- func (f TypedKey[Value]) SetAll(ctx context.Context, m *Storage, values ...Value) error
Constants ¶
This section is empty.
Variables ¶
var ErrMetadatumNotSet = errors.New("metadatum not set")
ErrMetadatumNotSet is returned by various [MetaStorage] functions when a metadatum is not set
Functions ¶
This section is empty.
Types ¶
type Meta ¶
type Meta struct { component.Base Dependencies struct { SQL *sql.SQL } // contains filtered or unexported fields }
Component meta is responsible for managing metadata per WissKI Instance
func (*Meta) Provision ¶
Provision provisions new meta storage for this instance. NOTE(twiesing): This is a no-op, because we implement Purge.
type Storage ¶
type Storage struct { Slug string // contains filtered or unexported fields }
Storage manages metadata for either the entire distillery, or a single slug
func (Storage) Get ¶
Get retrieves metadata with the provided key and deserializes the first one into target. If no metadatum exists, returns ErrMetadatumNotSet.
func (Storage) GetAll ¶
GetAll receives all metadata with the provided keys. For each received value, the targets function is called with the current index, and total number of results. The function is intended to return a target for deserialization.
When no metadatum exists, targets is not called, and nil error is returned.