Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.5.0
type Config struct {
KeyPrefix string
ScoreSetKeysKeySuffix string
KeyDelimiter string
ScoreKeyDelimiter string
HashStoreEnabled bool
}
Config contains configurations of a store
type Model ¶
type Model interface {
GetKeySuffix() string
GetScoreMap() map[string]interface{}
Serialized() []byte
Deserialized([]byte)
GetDatabaseNo() string
}
Model is an interface for redis objects
type Option ¶ added in v0.5.0
type Option func(c *Config)
Option configures a store
func WithHashStore ¶ added in v0.3.0
WithHashStore returns a StoreOption that enables or disables to store models into redis hash (default: true).
func WithKeyDelimiter ¶ added in v0.2.0
WithKeyDelimiter returns a StoreOption that specifies a key delimiter (default: :).
func WithKeyPrefix ¶
WithKeyPrefix returns a StoreOption that specifies key prefix If you does not set this option or set an empty string, it will use a model type name as key prefix.
func WithScoreKeyDelimiter ¶ added in v0.2.0
WithScoreKeyDelimiter returns a StoreOption that specifies a score key delimiter (default: /).
func WithScoreSetKeysKeySuffix ¶ added in v0.2.0
WithScoreSetKeysKeySuffix returns a StoreOption that specifies a score set suffix key prefix (default: scoreSetKeys).
type Store ¶
type Store interface {
List(ctx context.Context, dest interface{}, mods ...rq.Modifier) error
Get(ctx context.Context, dests ...Model) error
Put(ctx context.Context, src interface{}, ttl int) error
Delete(ctx context.Context, src interface{}) error
DeleteAll(ctx context.Context, mods ...rq.Modifier) error
Count(ctx context.Context, mods ...rq.Modifier) (int, error)
}
Store is an interface for providing CRUD operations for objects