Skip to content

feat: export cmder.SetFirstKeyPos to support build module commands #1991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Cmder interface {
String() string
stringArg(int) string
firstKeyPos() int8
setFirstKeyPos(int8)
SetFirstKeyPos(int8)

readTimeout() *time.Duration
readReply(rd *proto.Reader) error
Expand Down Expand Up @@ -159,7 +159,7 @@ func (cmd *baseCmd) firstKeyPos() int8 {
return cmd.keyPos
}

func (cmd *baseCmd) setFirstKeyPos(keyPos int8) {
func (cmd *baseCmd) SetFirstKeyPos(keyPos int8) {
cmd.keyPos = keyPos
}

Expand Down
26 changes: 13 additions & 13 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@ func (c cmdable) XRead(ctx context.Context, a *XReadArgs) *XStreamSliceCmd {
if a.Block >= 0 {
cmd.setReadTimeout(a.Block)
}
cmd.setFirstKeyPos(keyPos)
cmd.SetFirstKeyPos(keyPos)
_ = c(ctx, cmd)
return cmd
}
Expand Down Expand Up @@ -1917,7 +1917,7 @@ func (c cmdable) XReadGroup(ctx context.Context, a *XReadGroupArgs) *XStreamSlic
if a.Block >= 0 {
cmd.setReadTimeout(a.Block)
}
cmd.setFirstKeyPos(keyPos)
cmd.SetFirstKeyPos(keyPos)
_ = c(ctx, cmd)
return cmd
}
Expand Down Expand Up @@ -2393,7 +2393,7 @@ func (c cmdable) ZInterStore(ctx context.Context, destination string, store *ZSt
args = append(args, "zinterstore", destination, len(store.Keys))
args = store.appendArgs(args)
cmd := NewIntCmd(ctx, args...)
cmd.setFirstKeyPos(3)
cmd.SetFirstKeyPos(3)
_ = c(ctx, cmd)
return cmd
}
Expand All @@ -2403,7 +2403,7 @@ func (c cmdable) ZInter(ctx context.Context, store *ZStore) *StringSliceCmd {
args = append(args, "zinter", len(store.Keys))
args = store.appendArgs(args)
cmd := NewStringSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2)
cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd)
return cmd
}
Expand All @@ -2414,7 +2414,7 @@ func (c cmdable) ZInterWithScores(ctx context.Context, store *ZStore) *ZSliceCmd
args = store.appendArgs(args)
args = append(args, "withscores")
cmd := NewZSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2)
cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd)
return cmd
}
Expand Down Expand Up @@ -2741,7 +2741,7 @@ func (c cmdable) ZUnion(ctx context.Context, store ZStore) *StringSliceCmd {
args = append(args, "zunion", len(store.Keys))
args = store.appendArgs(args)
cmd := NewStringSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2)
cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd)
return cmd
}
Expand All @@ -2752,7 +2752,7 @@ func (c cmdable) ZUnionWithScores(ctx context.Context, store ZStore) *ZSliceCmd
args = store.appendArgs(args)
args = append(args, "withscores")
cmd := NewZSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2)
cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd)
return cmd
}
Expand All @@ -2762,7 +2762,7 @@ func (c cmdable) ZUnionStore(ctx context.Context, dest string, store *ZStore) *I
args = append(args, "zunionstore", dest, len(store.Keys))
args = store.appendArgs(args)
cmd := NewIntCmd(ctx, args...)
cmd.setFirstKeyPos(3)
cmd.SetFirstKeyPos(3)
_ = c(ctx, cmd)
return cmd
}
Expand Down Expand Up @@ -2792,7 +2792,7 @@ func (c cmdable) ZDiff(ctx context.Context, keys ...string) *StringSliceCmd {
}

cmd := NewStringSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2)
cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd)
return cmd
}
Expand All @@ -2808,7 +2808,7 @@ func (c cmdable) ZDiffWithScores(ctx context.Context, keys ...string) *ZSliceCmd
args[len(keys)+2] = "withscores"

cmd := NewZSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2)
cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd)
return cmd
}
Expand Down Expand Up @@ -3084,7 +3084,7 @@ func (c cmdable) MemoryUsage(ctx context.Context, key string, samples ...int) *I
args = append(args, "SAMPLES", samples[0])
}
cmd := NewIntCmd(ctx, args...)
cmd.setFirstKeyPos(2)
cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd)
return cmd
}
Expand All @@ -3101,7 +3101,7 @@ func (c cmdable) Eval(ctx context.Context, script string, keys []string, args ..
}
cmdArgs = appendArgs(cmdArgs, args)
cmd := NewCmd(ctx, cmdArgs...)
cmd.setFirstKeyPos(3)
cmd.SetFirstKeyPos(3)
_ = c(ctx, cmd)
return cmd
}
Expand All @@ -3116,7 +3116,7 @@ func (c cmdable) EvalSha(ctx context.Context, sha1 string, keys []string, args .
}
cmdArgs = appendArgs(cmdArgs, args)
cmd := NewCmd(ctx, cmdArgs...)
cmd.setFirstKeyPos(3)
cmd.SetFirstKeyPos(3)
_ = c(ctx, cmd)
return cmd
}
Expand Down