forked from mirror/redis
chore: fix some command names
This commit is contained in:
parent
5a806ca2ba
commit
9be4a9e6d3
18
command.go
18
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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue