mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
add InfoMap command (#2665)
Add an extended version of Info() to parse the results from a call to redis.Info so that it’s simpler to operate on any given item in the result. Signed-off-by: Nic Gibson <nic.gibson@redis.com>
This commit is contained in:
11
commands.go
11
commands.go
@ -571,6 +571,17 @@ func (c cmdable) Info(ctx context.Context, sections ...string) *StringCmd {
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (c cmdable) InfoMap(ctx context.Context, sections ...string) *InfoCmd {
|
||||
args := make([]interface{}, 1+len(sections))
|
||||
args[0] = "info"
|
||||
for i, section := range sections {
|
||||
args[i+1] = section
|
||||
}
|
||||
cmd := NewInfoCmd(ctx, args...)
|
||||
_ = c(ctx, cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (c cmdable) LastSave(ctx context.Context) *IntCmd {
|
||||
cmd := NewIntCmd(ctx, "lastsave")
|
||||
_ = c(ctx, cmd)
|
||||
|
Reference in New Issue
Block a user