Skip to content

Commit

Permalink
feat: 增加RawCmdable接口
Browse files Browse the repository at this point in the history
  • Loading branch information
祝黄清 committed Nov 9, 2022
1 parent 7964e3d commit c9b16e0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ type Pipeliner interface {
Exec(ctx context.Context) ([]interface{}, error)
}

func (c *client) Pipeline() Pipeliner { return c.cmdable.Pipeline() }
func (c *client) Pipeline() Pipeliner { return c.cmdable.Pipeline() }
func (c *client) RawCmdable() interface{} { return c.cmdable.RawCmdable() }
1 change: 1 addition & 0 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type Cmdable interface {
PoolStats() PoolStats
RegisterCollector(RegisterCollectorFunc)
Close() error
RawCmdable() interface{}

CacheCmdable
BitmapCmdable
Expand Down
2 changes: 2 additions & 0 deletions redis_resp2.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ func (p *pipelineResp2) Exec(ctx context.Context) ([]interface{}, error) {
return result, err
}

func (r *resp2) RawCmdable() interface{} { return r.cmd }

func (r *resp2) Publish(ctx context.Context, channel string, message interface{}) IntCmd {
return r.cmd.Publish(ctx, channel, message)
}
Expand Down
2 changes: 2 additions & 0 deletions redis_resp3.go
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,8 @@ func (p *pipelineResp3) Exec(_ context.Context) ([]interface{}, error) {
return p.res, p.firstError
}

func (r *resp3) RawCmdable() interface{} { return r.cmd }

func (r *resp3) Publish(ctx context.Context, channel string, message interface{}) IntCmd {
return newIntCmd(r.cmd.Do(ctx, r.cmd.B().Publish().Channel(channel).Message(str(message)).Build()))
}
Expand Down

0 comments on commit c9b16e0

Please sign in to comment.