Versions in this module Expand all Collapse all v1 v1.0.25 Dec 22, 2023 v1.0.8 Jun 12, 2023 Changes in this version + var EndOfCursor = errors.New("end of cursor") + var ErrEmptyHashRecord = errors.New("hash object not found") + var ErrVersionMismatch = errors.New("object version mismatched, please retry") + func IsRecordNotFound(err error) bool + type AggregateCursor struct + func (c *AggregateCursor) Del(ctx context.Context) (err error) + func (c *AggregateCursor) Read(ctx context.Context) (partial []map[string]string, err error) + func (c *AggregateCursor) Total() int64 + type Arbitrary = cmds.Arbitrary + type FtAggregateIndex = cmds.FtAggregateIndex + type FtCreateSchema = cmds.FtCreateSchema + type FtSearchIndex = cmds.FtSearchIndex + type HashRepository struct + func (r *HashRepository[T]) Aggregate(ctx context.Context, cmdFn func(search FtAggregateIndex) rueidis.Completed) (cursor *AggregateCursor, err error) + func (r *HashRepository[T]) CreateIndex(ctx context.Context, cmdFn func(schema FtCreateSchema) rueidis.Completed) error + func (r *HashRepository[T]) DropIndex(ctx context.Context) error + func (r *HashRepository[T]) Fetch(ctx context.Context, id string) (v *T, err error) + func (r *HashRepository[T]) FetchCache(ctx context.Context, id string, ttl time.Duration) (v *T, err error) + func (r *HashRepository[T]) IndexName() string + func (r *HashRepository[T]) NewEntity() (entity *T) + func (r *HashRepository[T]) Remove(ctx context.Context, id string) error + func (r *HashRepository[T]) Save(ctx context.Context, entity *T) (err error) + func (r *HashRepository[T]) SaveMulti(ctx context.Context, entities ...*T) []error + func (r *HashRepository[T]) Search(ctx context.Context, cmdFn func(search FtSearchIndex) rueidis.Completed) (n int64, s []*T, err error) + type JSONRepository struct + func (r *JSONRepository[T]) Aggregate(ctx context.Context, cmdFn func(search FtAggregateIndex) rueidis.Completed) (cursor *AggregateCursor, err error) + func (r *JSONRepository[T]) CreateIndex(ctx context.Context, cmdFn func(schema FtCreateSchema) rueidis.Completed) error + func (r *JSONRepository[T]) DropIndex(ctx context.Context) error + func (r *JSONRepository[T]) Fetch(ctx context.Context, id string) (v *T, err error) + func (r *JSONRepository[T]) FetchCache(ctx context.Context, id string, ttl time.Duration) (v *T, err error) + func (r *JSONRepository[T]) IndexName() string + func (r *JSONRepository[T]) NewEntity() *T + func (r *JSONRepository[T]) Remove(ctx context.Context, id string) error + func (r *JSONRepository[T]) Save(ctx context.Context, entity *T) (err error) + func (r *JSONRepository[T]) SaveMulti(ctx context.Context, entities ...*T) []error + func (r *JSONRepository[T]) Search(ctx context.Context, cmdFn func(search FtSearchIndex) rueidis.Completed) (n int64, s []*T, err error) + type Repository interface + Aggregate func(ctx context.Context, cmdFn func(search FtAggregateIndex) rueidis.Completed) (*AggregateCursor, error) + CreateIndex func(ctx context.Context, cmdFn func(schema FtCreateSchema) rueidis.Completed) error + DropIndex func(ctx context.Context) error + Fetch func(ctx context.Context, id string) (*T, error) + FetchCache func(ctx context.Context, id string, ttl time.Duration) (v *T, err error) + IndexName func() string + NewEntity func() (entity *T) + Remove func(ctx context.Context, id string) error + Save func(ctx context.Context, entity *T) (err error) + SaveMulti func(ctx context.Context, entity ...*T) (errs []error) + Search func(ctx context.Context, cmdFn func(search FtSearchIndex) rueidis.Completed) (int64, []*T, error) + func NewHashRepository(prefix string, schema T, client rueidis.Client, opts ...RepositoryOption) Repository[T] + func NewJSONRepository(prefix string, schema T, client rueidis.Client, opts ...RepositoryOption) Repository[T] + type RepositoryOption func(Repository[any]) + func WithIndexName(name string) RepositoryOption