Versions in this module Expand all Collapse all v0 v0.1.0 Mar 6, 2024 Changes in this version + var ErrDeserialize = errors.New("couldn't deserialize data") + var ErrEmptyKey = errors.New("empty key") + var ErrInvalidFilter = errors.New("invalid filter") + var ErrInvalidOption = errors.New("invalid option") + var ErrNotFound = errors.New("not found") + var ErrSerialize = errors.New("couldn't serialize object") + type BaseKeyValueMap interface + Delete func(ctx context.Context, keys ...string) error + GetAll func(ctx context.Context) (map[string]string, error) + GetMany func(ctx context.Context, keys []string) (map[string]string, error) + GetOne func(ctx context.Context, key string) (string, error) + SetMany func(ctx context.Context, items map[string]string) error + SetOne func(ctx context.Context, key, value string) error + UpdateMany func(ctx context.Context, keys []string, ...) error + UpdateOne func(ctx context.Context, key string, update func(string, *string) (*string, error)) error + type BaseKeyValueStore interface + Delete func(ctx context.Context, keys ...string) error + GetAll func(ctx context.Context) (map[string]*T, error) + GetMany func(ctx context.Context, keys []string) (map[string]*T, error) + GetOne func(ctx context.Context, key string) (*T, error) + SetMany func(ctx context.Context, items map[string]*T) error + SetOne func(ctx context.Context, key string, value *T) error + UpdateMany func(ctx context.Context, keys []string, update func(string, *T) (*T, error)) error + UpdateOne func(ctx context.Context, key string, update func(string, *T) (*T, error)) error + type ErrorMap struct + ErrDeserialize error + ErrEmptyKey error + ErrInvalidFilter error + ErrInvalidOption error + ErrNotFound error + ErrSerialize error + func (e *ErrorMap) InitDefaultErrors() + type ErrorMapSetter interface + SetErrorMap func(ErrorMap) + type FilterSpec struct + All []*FilterSpec + Any []*FilterSpec + Where *WhereClause + func All(filters ...*FilterSpec) *FilterSpec + func Any(filters ...*FilterSpec) *FilterSpec + func Where(fieldName string, op string, value any) *FilterSpec + type KeyValue interface + type KeyValueMap interface + type Lister interface + List func(ctx context.Context, opts ...*Options) ([]*T, error) + type Options struct + Filter *FilterSpec + Limit int + Offset int + OrderBy *OrderBySpec + func Filter(spec *FilterSpec) *Options + func Limit(n int) *Options + func Offset(n int) *Options + func Order(order *OrderBySpec) *Options + func Paginate(limit, offset int) *Options + type OrderBySpec struct + Descending bool + Field string + func By(field string) *OrderBySpec + func (o *OrderBySpec) Asc() *OrderBySpec + func (o *OrderBySpec) Desc() *OrderBySpec + type Resetter interface + Reset func(ctx context.Context) error + type Serializer interface + Deserialize func(string) (*T, error) + Serialize func(*T) (string, error) + type WhereClause struct + Field string + Op string + Value any