1
0
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:
Nic Gibson
2023-10-30 16:07:42 +00:00
committed by GitHub
parent 4408f8cfb2
commit 343016bf72
3 changed files with 108 additions and 0 deletions

View File

@ -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)