Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrEmptyKey = errors.New("empty key") ErrSerialize = errors.New("couldn't serialize object") ErrDeserialize = errors.New("couldn't deserialize data") ErrInvalidOption = errors.New("invalid option") ErrInvalidFilter = errors.New("invalid filter") )
Functions ¶
This section is empty.
Types ¶
type BaseKeyValueMap ¶
type BaseKeyValueMap interface { GetOne(ctx context.Context, key string) (string, error) GetMany(ctx context.Context, keys []string) (map[string]string, error) GetAll(ctx context.Context) (map[string]string, error) SetOne(ctx context.Context, key, value string) error SetMany(ctx context.Context, items map[string]string) error UpdateOne(ctx context.Context, key string, update func(string, *string) (*string, error)) error UpdateMany(ctx context.Context, keys []string, update func(string, *string) (*string, error)) error Delete(ctx context.Context, keys ...string) error }
type BaseKeyValueStore ¶
type BaseKeyValueStore[T any] interface { GetOne(ctx context.Context, key string) (*T, error) GetMany(ctx context.Context, keys []string) (map[string]*T, error) GetAll(ctx context.Context) (map[string]*T, error) SetOne(ctx context.Context, key string, value *T) error SetMany(ctx context.Context, items map[string]*T) error UpdateOne(ctx context.Context, key string, update func(string, *T) (*T, error)) error UpdateMany(ctx context.Context, keys []string, update func(string, *T) (*T, error)) error Delete(ctx context.Context, keys ...string) error }
type ErrorMap ¶
type ErrorMap struct { ErrNotFound error ErrEmptyKey error ErrSerialize error ErrDeserialize error ErrInvalidOption error ErrInvalidFilter error }
func (*ErrorMap) InitDefaultErrors ¶
func (e *ErrorMap) InitDefaultErrors()
type ErrorMapSetter ¶
type ErrorMapSetter interface {
SetErrorMap(ErrorMap)
}
type FilterSpec ¶
type FilterSpec struct { Where *WhereClause All []*FilterSpec Any []*FilterSpec }
func All ¶
func All(filters ...*FilterSpec) *FilterSpec
func Any ¶
func Any(filters ...*FilterSpec) *FilterSpec
type KeyValue ¶
type KeyValue[T any] interface { BaseKeyValueStore[T] Lister[T] ErrorMapSetter Resetter }
type KeyValueMap ¶
type KeyValueMap interface { BaseKeyValueMap ErrorMapSetter Resetter }
type Options ¶
type Options struct { Filter *FilterSpec OrderBy *OrderBySpec Limit int Offset int }
func Filter ¶
func Filter(spec *FilterSpec) *Options
func Order ¶
func Order(order *OrderBySpec) *Options
type OrderBySpec ¶
func By ¶
func By(field string) *OrderBySpec
func (*OrderBySpec) Asc ¶
func (o *OrderBySpec) Asc() *OrderBySpec
func (*OrderBySpec) Desc ¶
func (o *OrderBySpec) Desc() *OrderBySpec
type Serializer ¶
type WhereClause ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.