chore: export cmder.SetFirstKeyPos to support build module commands

This commit is contained in:
gzjiangtao2014 2022-01-11 14:47:55 +08:00
parent 955df2c4c4
commit f4bf09cfc8
2 changed files with 15 additions and 15 deletions

View File

@ -20,7 +20,7 @@ type Cmder interface {
String() string String() string
stringArg(int) string stringArg(int) string
firstKeyPos() int8 firstKeyPos() int8
setFirstKeyPos(int8) SetFirstKeyPos(int8)
readTimeout() *time.Duration readTimeout() *time.Duration
readReply(rd *proto.Reader) error readReply(rd *proto.Reader) error
@ -159,7 +159,7 @@ func (cmd *baseCmd) firstKeyPos() int8 {
return cmd.keyPos return cmd.keyPos
} }
func (cmd *baseCmd) setFirstKeyPos(keyPos int8) { func (cmd *baseCmd) SetFirstKeyPos(keyPos int8) {
cmd.keyPos = keyPos cmd.keyPos = keyPos
} }

View File

@ -1833,7 +1833,7 @@ func (c cmdable) XRead(ctx context.Context, a *XReadArgs) *XStreamSliceCmd {
if a.Block >= 0 { if a.Block >= 0 {
cmd.setReadTimeout(a.Block) cmd.setReadTimeout(a.Block)
} }
cmd.setFirstKeyPos(keyPos) cmd.SetFirstKeyPos(keyPos)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -1917,7 +1917,7 @@ func (c cmdable) XReadGroup(ctx context.Context, a *XReadGroupArgs) *XStreamSlic
if a.Block >= 0 { if a.Block >= 0 {
cmd.setReadTimeout(a.Block) cmd.setReadTimeout(a.Block)
} }
cmd.setFirstKeyPos(keyPos) cmd.SetFirstKeyPos(keyPos)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -2393,7 +2393,7 @@ func (c cmdable) ZInterStore(ctx context.Context, destination string, store *ZSt
args = append(args, "zinterstore", destination, len(store.Keys)) args = append(args, "zinterstore", destination, len(store.Keys))
args = store.appendArgs(args) args = store.appendArgs(args)
cmd := NewIntCmd(ctx, args...) cmd := NewIntCmd(ctx, args...)
cmd.setFirstKeyPos(3) cmd.SetFirstKeyPos(3)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -2403,7 +2403,7 @@ func (c cmdable) ZInter(ctx context.Context, store *ZStore) *StringSliceCmd {
args = append(args, "zinter", len(store.Keys)) args = append(args, "zinter", len(store.Keys))
args = store.appendArgs(args) args = store.appendArgs(args)
cmd := NewStringSliceCmd(ctx, args...) cmd := NewStringSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2) cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -2414,7 +2414,7 @@ func (c cmdable) ZInterWithScores(ctx context.Context, store *ZStore) *ZSliceCmd
args = store.appendArgs(args) args = store.appendArgs(args)
args = append(args, "withscores") args = append(args, "withscores")
cmd := NewZSliceCmd(ctx, args...) cmd := NewZSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2) cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -2741,7 +2741,7 @@ func (c cmdable) ZUnion(ctx context.Context, store ZStore) *StringSliceCmd {
args = append(args, "zunion", len(store.Keys)) args = append(args, "zunion", len(store.Keys))
args = store.appendArgs(args) args = store.appendArgs(args)
cmd := NewStringSliceCmd(ctx, args...) cmd := NewStringSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2) cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -2752,7 +2752,7 @@ func (c cmdable) ZUnionWithScores(ctx context.Context, store ZStore) *ZSliceCmd
args = store.appendArgs(args) args = store.appendArgs(args)
args = append(args, "withscores") args = append(args, "withscores")
cmd := NewZSliceCmd(ctx, args...) cmd := NewZSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2) cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -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 = append(args, "zunionstore", dest, len(store.Keys))
args = store.appendArgs(args) args = store.appendArgs(args)
cmd := NewIntCmd(ctx, args...) cmd := NewIntCmd(ctx, args...)
cmd.setFirstKeyPos(3) cmd.SetFirstKeyPos(3)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -2792,7 +2792,7 @@ func (c cmdable) ZDiff(ctx context.Context, keys ...string) *StringSliceCmd {
} }
cmd := NewStringSliceCmd(ctx, args...) cmd := NewStringSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2) cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -2808,7 +2808,7 @@ func (c cmdable) ZDiffWithScores(ctx context.Context, keys ...string) *ZSliceCmd
args[len(keys)+2] = "withscores" args[len(keys)+2] = "withscores"
cmd := NewZSliceCmd(ctx, args...) cmd := NewZSliceCmd(ctx, args...)
cmd.setFirstKeyPos(2) cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -3084,7 +3084,7 @@ func (c cmdable) MemoryUsage(ctx context.Context, key string, samples ...int) *I
args = append(args, "SAMPLES", samples[0]) args = append(args, "SAMPLES", samples[0])
} }
cmd := NewIntCmd(ctx, args...) cmd := NewIntCmd(ctx, args...)
cmd.setFirstKeyPos(2) cmd.SetFirstKeyPos(2)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -3101,7 +3101,7 @@ func (c cmdable) Eval(ctx context.Context, script string, keys []string, args ..
} }
cmdArgs = appendArgs(cmdArgs, args) cmdArgs = appendArgs(cmdArgs, args)
cmd := NewCmd(ctx, cmdArgs...) cmd := NewCmd(ctx, cmdArgs...)
cmd.setFirstKeyPos(3) cmd.SetFirstKeyPos(3)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }
@ -3116,7 +3116,7 @@ func (c cmdable) EvalSha(ctx context.Context, sha1 string, keys []string, args .
} }
cmdArgs = appendArgs(cmdArgs, args) cmdArgs = appendArgs(cmdArgs, args)
cmd := NewCmd(ctx, cmdArgs...) cmd := NewCmd(ctx, cmdArgs...)
cmd.setFirstKeyPos(3) cmd.SetFirstKeyPos(3)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }