From 9be4a9e6d3954397db2369ba03bdc49d0bdfd12e Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Mon, 8 Aug 2022 10:28:46 +0300 Subject: [PATCH] chore: fix some command names --- command.go | 18 +++++++++--------- commands.go | 6 +++--- result.go | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/command.go b/command.go index 2586ea7d..d4fc91de 100644 --- a/command.go +++ b/command.go @@ -1292,16 +1292,16 @@ func (cmd *MapStringStringCmd) readReply(rd *proto.Reader) error { //------------------------------------------------------------------------------ -type StringIntMapCmd struct { +type MapStringIntCmd struct { baseCmd val map[string]int64 } -var _ Cmder = (*StringIntMapCmd)(nil) +var _ Cmder = (*MapStringIntCmd)(nil) -func NewStringIntMapCmd(ctx context.Context, args ...interface{}) *StringIntMapCmd { - return &StringIntMapCmd{ +func NewMapStringIntCmd(ctx context.Context, args ...interface{}) *MapStringIntCmd { + return &MapStringIntCmd{ baseCmd: baseCmd{ ctx: ctx, 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 } -func (cmd *StringIntMapCmd) Val() map[string]int64 { +func (cmd *MapStringIntCmd) Val() map[string]int64 { return cmd.val } -func (cmd *StringIntMapCmd) Result() (map[string]int64, error) { +func (cmd *MapStringIntCmd) Result() (map[string]int64, error) { return cmd.val, cmd.err } -func (cmd *StringIntMapCmd) String() string { +func (cmd *MapStringIntCmd) String() string { 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() if err != nil { return err diff --git a/commands.go b/commands.go index beb3af2d..57de25b0 100644 --- a/commands.go +++ b/commands.go @@ -346,7 +346,7 @@ type Cmdable interface { Publish(ctx context.Context, channel string, message interface{}) *IntCmd 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 ClusterSlots(ctx context.Context) *ClusterSlotsCmd @@ -3088,14 +3088,14 @@ func (c cmdable) PubSubChannels(ctx context.Context, pattern string) *StringSlic 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[0] = "pubsub" args[1] = "numsub" for i, channel := range channels { args[2+i] = channel } - cmd := NewStringIntMapCmd(ctx, args...) + cmd := NewMapStringIntCmd(ctx, args...) _ = c(ctx, cmd) return cmd } diff --git a/result.go b/result.go index 9401dfee..44741b01 100644 --- a/result.go +++ b/result.go @@ -83,16 +83,16 @@ func NewBoolSliceResult(val []bool, err error) *BoolSliceCmd { } // 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 cmd.val = val cmd.SetErr(err) return &cmd } -// NewStringIntMapCmdResult returns a StringIntMapCmd initialised with val and err for testing. -func NewStringIntMapCmdResult(val map[string]int64, err error) *StringIntMapCmd { - var cmd StringIntMapCmd +// NewMapStringIntCmdResult returns a MapStringIntCmd initialised with val and err for testing. +func NewMapStringIntCmdResult(val map[string]int64, err error) *MapStringIntCmd { + var cmd MapStringIntCmd cmd.val = val cmd.SetErr(err) return &cmd