Documentation ¶
Index ¶
- type RedisV9
- func (r *RedisV9) AddMember(ctx context.Context, key, member string) error
- func (r *RedisV9) AddScoredMember(ctx context.Context, key, member string, score float64) (int64, error)
- func (r *RedisV9) Append(ctx context.Context, pipelined bool, key string, values ...[]byte) error
- func (h *RedisV9) As(i interface{}) bool
- func (r *RedisV9) Decrement(ctx context.Context, key string) (int64, error)
- func (r *RedisV9) Delete(ctx context.Context, key string) error
- func (r *RedisV9) DeleteKeys(ctx context.Context, keys []string) (int64, error)
- func (r *RedisV9) DeleteScanMatch(ctx context.Context, pattern string) (int64, error)
- func (h *RedisV9) Disconnect(ctx context.Context) error
- func (r *RedisV9) Exists(ctx context.Context, key string) (bool, error)
- func (r *RedisV9) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (r *RedisV9) FlushAll(ctx context.Context) error
- func (r *RedisV9) Get(ctx context.Context, key string) (string, error)
- func (r *RedisV9) GetKeysAndValuesWithFilter(ctx context.Context, pattern string) (map[string]interface{}, error)
- func (r *RedisV9) GetKeysWithOpts(ctx context.Context, searchStr string, cursor map[string]uint64, count int64) ([]string, map[string]uint64, bool, error)
- func (r *RedisV9) GetMembersByScoreRange(ctx context.Context, key, min, max string) ([]interface{}, []float64, error)
- func (r *RedisV9) GetMulti(ctx context.Context, keys []string) ([]interface{}, error)
- func (r *RedisV9) Increment(ctx context.Context, key string) (int64, error)
- func (r *RedisV9) IsMember(ctx context.Context, key, member string) (bool, error)
- func (r *RedisV9) Keys(ctx context.Context, pattern string) ([]string, error)
- func (r *RedisV9) Length(ctx context.Context, key string) (int64, error)
- func (r *RedisV9) Members(ctx context.Context, key string) ([]string, error)
- func (h *RedisV9) Ping(ctx context.Context) error
- func (r *RedisV9) Pop(ctx context.Context, key string, stop int64) ([]string, error)
- func (r *RedisV9) Prepend(ctx context.Context, pipelined bool, key string, values ...[]byte) error
- func (r *RedisV9) Publish(ctx context.Context, channel, message string) (int64, error)
- func (r *RedisV9) Range(ctx context.Context, key string, start, stop int64) ([]string, error)
- func (r *RedisV9) Remove(ctx context.Context, key string, count int64, element interface{}) (int64, error)
- func (r *RedisV9) RemoveMember(ctx context.Context, key, member string) error
- func (r *RedisV9) RemoveMembersByScoreRange(ctx context.Context, key, min, max string) (int64, error)
- func (r *RedisV9) Set(ctx context.Context, key, value string, expiration time.Duration) error
- func (r *RedisV9) SetIfNotExist(ctx context.Context, key, value string, expiration time.Duration) (bool, error)
- func (r *RedisV9) Subscribe(ctx context.Context, channels ...string) model.Subscription
- func (r *RedisV9) TTL(ctx context.Context, key string) (int64, error)
- func (h *RedisV9) Type() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisV9 ¶
type RedisV9 struct {
// contains filtered or unexported fields
}
func NewRedisV9WithConnection ¶
NewRedisV9WithConnection returns a new redisv8List instance with a custom redis connection.
func NewRedisV9WithOpts ¶
NewList returns a new RedisV9 instance.
func (*RedisV9) AddMember ¶
Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members. It errors if the key is not a set.
func (*RedisV9) AddScoredMember ¶
func (r *RedisV9) AddScoredMember(ctx context.Context, key, member string, score float64) (int64, error)
AddScoredMember adds a member with a specific score to a sorted set in Redis. It returns the number of elements added to the sorted set, which is either 0 or 1.
func (*RedisV9) Append ¶
Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned. Equivalent to RPush.
func (*RedisV9) As ¶
As converts i to driver-specific types. redisv9 connector supports only *redis.UniversalClient. Same concept as https://gocloud.dev/concepts/as/ but for connectors.
func (*RedisV9) DeleteKeys ¶
DeleteKeys removes the specified keys. A key is ignored if it does not exist
func (*RedisV9) DeleteScanMatch ¶
DeleteScanMatch deletes all keys matching the given pattern
func (*RedisV9) Expire ¶
Expire sets a timeout on key. After the timeout has expired, the key will automatically be deleted
func (*RedisV9) GetKeysAndValuesWithFilter ¶
func (r *RedisV9) GetKeysAndValuesWithFilter(ctx context.Context, pattern string, ) (map[string]interface{}, error)
GetKeysAndValuesWithFilter returns all keys and their values for a given pattern
func (*RedisV9) GetKeysWithOpts ¶
func (r *RedisV9) GetKeysWithOpts(ctx context.Context, searchStr string, cursor map[string]uint64, count int64, ) ([]string, map[string]uint64, bool, error)
GetKeysWithOpts performs a paginated scan of keys in a Redis database using the SCAN command. It receives a cursor map that contains the cursor position for each Redis node in the cluster.
Parameters:
ctx: Execution context. searchStr: Pattern for filtering keys (glob-style patterns allowed). cursor: Map of Redis node addresses to cursor positions for pagination. In the first iteration, map must be empty or nil. count: Approximate number of keys to return per scan.
Returns:
keys: Slice of keys matching the searchStr pattern. updatedCursor: Updated cursor map for subsequent pagination. continueScan: Indicates if more keys are available for scanning (true if any cursor is non-zero). err: Error, if any occurred during execution.
func (*RedisV9) GetMembersByScoreRange ¶
func (r *RedisV9) GetMembersByScoreRange(ctx context.Context, key, min, max string) ([]interface{}, []float64, error)
GetMembersByScoreRange retrieves members and their scores from a Redis sorted set within the given score range specified by min and max. It returns slices of members and their scores, and an error if any occurs during retrieval.
func (*RedisV9) Length ¶
Returns the length of the list stored at key. If key does not exist, it is interpreted as an empty list and 0 is returned. An error is returned when the value stored at key is not a list. Equivalent of LLen.
func (*RedisV9) Pop ¶
Pop removes and returns the first count elements of the list stored at key. If stop is -1, all the elements from start to the end of the list are removed and returned.
func (*RedisV9) Prepend ¶
Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned. Equivalent to LPush.
func (*RedisV9) Range ¶
Returns the specified elements of the list stored at key. The offsets start and stop are zero-based indexes, with 0 being the first element of the list (the head of the list), 1 being the next element and so on. Equivalent of LRange.
func (*RedisV9) Remove ¶
func (r *RedisV9) Remove(ctx context.Context, key string, count int64, element interface{}) (int64, error)
Remove the first count occurrences of elements equal to element from the list stored at key. The count argument influences the operation in the following ways: count > 0: Remove elements equal to element moving from head to tail. count < 0: Remove elements equal to element moving from tail to head. count = 0: Remove all elements equal to element. Equivalent of LRem.
func (*RedisV9) RemoveMember ¶
Remove the specified members from the set stored at key. Specified members that are not a member of this set are ignored. It errors if the key is not a set.
func (*RedisV9) RemoveMembersByScoreRange ¶
func (r *RedisV9) RemoveMembersByScoreRange(ctx context.Context, key, min, max string) (int64, error)
RemoveMembersByScoreRange removes members from a Redis sorted set within a specified score range. It returns the number of members removed from the sorted set.