mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Add support for LCS Command (#2480)
* feat: initial set up for LCSCmd * feat: adding test for LCS with no additional params * feat: adding test for LCS with LEN param * feat: resolving conflicts in command.go * fix: changing reply and query structure * feat: commands test for lcs and lcs with len * fix: using dynamic args length * fix: read * fix: Cmd init * sorting out the LCS commands Signed-off-by: monkey92t <golang@88.com> * fix: Adding error case test * fix: adding correct error message * fix: removed blank lines --------- Signed-off-by: monkey92t <golang@88.com> Co-authored-by: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com> Co-authored-by: monkey92t <golang@88.com>
This commit is contained in:
committed by
GitHub
parent
38aa0b7792
commit
6790337e5d
14
commands.go
14
commands.go
@ -227,6 +227,7 @@ type Cmdable interface {
|
||||
BLMPop(ctx context.Context, timeout time.Duration, direction string, count int64, keys ...string) *KeyValuesCmd
|
||||
BRPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd
|
||||
BRPopLPush(ctx context.Context, source, destination string, timeout time.Duration) *StringCmd
|
||||
LCS(ctx context.Context, q *LCSQuery) *LCSCmd
|
||||
LIndex(ctx context.Context, key string, index int64) *StringCmd
|
||||
LInsert(ctx context.Context, key, op string, pivot, value interface{}) *IntCmd
|
||||
LInsertBefore(ctx context.Context, key string, pivot, value interface{}) *IntCmd
|
||||
@ -543,6 +544,13 @@ func (c cmdable) Command(ctx context.Context) *CommandsInfoCmd {
|
||||
return cmd
|
||||
}
|
||||
|
||||
// FilterBy is used for the `CommandList` command parameter.
|
||||
type FilterBy struct {
|
||||
Module string
|
||||
ACLCat string
|
||||
Pattern string
|
||||
}
|
||||
|
||||
func (c cmdable) CommandList(ctx context.Context, filter *FilterBy) *StringSliceCmd {
|
||||
args := make([]interface{}, 0, 5)
|
||||
args = append(args, "command", "list")
|
||||
@ -1524,6 +1532,12 @@ func (c cmdable) BRPopLPush(ctx context.Context, source, destination string, tim
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (c cmdable) LCS(ctx context.Context, q *LCSQuery) *LCSCmd {
|
||||
cmd := NewLCSCmd(ctx, q)
|
||||
_ = c(ctx, cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (c cmdable) LIndex(ctx context.Context, key string, index int64) *StringCmd {
|
||||
cmd := NewStringCmd(ctx, "lindex", key, index)
|
||||
_ = c(ctx, cmd)
|
||||
|
Reference in New Issue
Block a user