chore: fix some command names

This commit is contained in:
Vladimir Mihailenco 2022-08-08 10:28:46 +03:00
parent 5a806ca2ba
commit 9be4a9e6d3
3 changed files with 16 additions and 16 deletions

View File

@ -1292,16 +1292,16 @@ func (cmd *MapStringStringCmd) readReply(rd *proto.Reader) error {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
type StringIntMapCmd struct { type MapStringIntCmd struct {
baseCmd baseCmd
val map[string]int64 val map[string]int64
} }
var _ Cmder = (*StringIntMapCmd)(nil) var _ Cmder = (*MapStringIntCmd)(nil)
func NewStringIntMapCmd(ctx context.Context, args ...interface{}) *StringIntMapCmd { func NewMapStringIntCmd(ctx context.Context, args ...interface{}) *MapStringIntCmd {
return &StringIntMapCmd{ return &MapStringIntCmd{
baseCmd: baseCmd{ baseCmd: baseCmd{
ctx: ctx, ctx: ctx,
args: args, args: args,
@ -1309,23 +1309,23 @@ func NewStringIntMapCmd(ctx context.Context, args ...interface{}) *StringIntMapC
} }
} }
func (cmd *StringIntMapCmd) SetVal(val map[string]int64) { func (cmd *MapStringIntCmd) SetVal(val map[string]int64) {
cmd.val = val cmd.val = val
} }
func (cmd *StringIntMapCmd) Val() map[string]int64 { func (cmd *MapStringIntCmd) Val() map[string]int64 {
return cmd.val return cmd.val
} }
func (cmd *StringIntMapCmd) Result() (map[string]int64, error) { func (cmd *MapStringIntCmd) Result() (map[string]int64, error) {
return cmd.val, cmd.err return cmd.val, cmd.err
} }
func (cmd *StringIntMapCmd) String() string { func (cmd *MapStringIntCmd) String() string {
return cmdString(cmd, cmd.val) return cmdString(cmd, cmd.val)
} }
func (cmd *StringIntMapCmd) readReply(rd *proto.Reader) error { func (cmd *MapStringIntCmd) readReply(rd *proto.Reader) error {
n, err := rd.ReadMapLen() n, err := rd.ReadMapLen()
if err != nil { if err != nil {
return err return err

View File

@ -346,7 +346,7 @@ type Cmdable interface {
Publish(ctx context.Context, channel string, message interface{}) *IntCmd Publish(ctx context.Context, channel string, message interface{}) *IntCmd
PubSubChannels(ctx context.Context, pattern string) *StringSliceCmd PubSubChannels(ctx context.Context, pattern string) *StringSliceCmd
PubSubNumSub(ctx context.Context, channels ...string) *StringIntMapCmd PubSubNumSub(ctx context.Context, channels ...string) *MapStringIntCmd
PubSubNumPat(ctx context.Context) *IntCmd PubSubNumPat(ctx context.Context) *IntCmd
ClusterSlots(ctx context.Context) *ClusterSlotsCmd ClusterSlots(ctx context.Context) *ClusterSlotsCmd
@ -3088,14 +3088,14 @@ func (c cmdable) PubSubChannels(ctx context.Context, pattern string) *StringSlic
return cmd return cmd
} }
func (c cmdable) PubSubNumSub(ctx context.Context, channels ...string) *StringIntMapCmd { func (c cmdable) PubSubNumSub(ctx context.Context, channels ...string) *MapStringIntCmd {
args := make([]interface{}, 2+len(channels)) args := make([]interface{}, 2+len(channels))
args[0] = "pubsub" args[0] = "pubsub"
args[1] = "numsub" args[1] = "numsub"
for i, channel := range channels { for i, channel := range channels {
args[2+i] = channel args[2+i] = channel
} }
cmd := NewStringIntMapCmd(ctx, args...) cmd := NewMapStringIntCmd(ctx, args...)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }

View File

@ -83,16 +83,16 @@ func NewBoolSliceResult(val []bool, err error) *BoolSliceCmd {
} }
// NewStringStringMapResult returns a StringStringMapCmd initialised with val and err for testing. // NewStringStringMapResult returns a StringStringMapCmd initialised with val and err for testing.
func NewStringStringMapResult(val map[string]string, err error) *MapStringStringCmd { func NewMapStringStringResult(val map[string]string, err error) *MapStringStringCmd {
var cmd MapStringStringCmd var cmd MapStringStringCmd
cmd.val = val cmd.val = val
cmd.SetErr(err) cmd.SetErr(err)
return &cmd return &cmd
} }
// NewStringIntMapCmdResult returns a StringIntMapCmd initialised with val and err for testing. // NewMapStringIntCmdResult returns a MapStringIntCmd initialised with val and err for testing.
func NewStringIntMapCmdResult(val map[string]int64, err error) *StringIntMapCmd { func NewMapStringIntCmdResult(val map[string]int64, err error) *MapStringIntCmd {
var cmd StringIntMapCmd var cmd MapStringIntCmd
cmd.val = val cmd.val = val
cmd.SetErr(err) cmd.SetErr(err)
return &cmd return &cmd