Skip to content

Commit

Permalink
feat: Add ACLCatArgs to rueidiscompat
Browse files Browse the repository at this point in the history
  • Loading branch information
CheyuWu committed Feb 12, 2025
1 parent 98c2e01 commit f60ce19
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions rueidiscompat/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ type CoreCmdable interface {
ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd
ACLDelUser(ctx context.Context, username string) *IntCmd
ACLLogReset(ctx context.Context) *StatusCmd
ACLCatArgs(ctx context.Context, options *ACLCatArgs) *StringSliceCmd

ModuleLoadex(ctx context.Context, conf *ModuleLoadexConfig) *StringCmd
GearsCmdable
Expand Down Expand Up @@ -3204,6 +3205,22 @@ func (c *Compat) ACLDryRun(ctx context.Context, username string, command ...any)
return newStringCmd(resp)
}

type ACLCatArgs struct {
Category string
}

func (c *Compat) ACLCatArgs(ctx context.Context, options *ACLCatArgs) *StringSliceCmd {
// if there is a category passed, build new cmd, if there isn't - use the ACLCat method
if options != nil && options.Category != "" {
cmd := c.client.B().AclCat().Categoryname(options.Category).Build()
resp := c.client.Do(ctx, cmd)
return newStringSliceCmd(resp)
}
return c.ACLCat(ctx)
}

func (c *Compat) ACLCat(ctx context.Context) *StringSliceCmd

func (c *Compat) ACLLog(ctx context.Context, count int64) *ACLLogCmd {
cmd := c.client.B().AclLog().Count(count).Build()
resp := c.client.Do(ctx, cmd)
Expand Down
6 changes: 6 additions & 0 deletions rueidiscompat/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,12 @@ func (c *Pipeline) ACLLogReset(ctx context.Context) *StatusCmd {
return ret
}

func (c *Pipeline) ACLCatArgs(ctx context.Context, options *ACLCatArgs) *StringSliceCmd {
ret := c.comp.ACLCatArgs(ctx, options)
c.rets = append(c.rets, ret)
return ret
}

func (c *Pipeline) TFunctionLoad(ctx context.Context, lib string) *StatusCmd {
ret := c.comp.TFunctionLoad(ctx, lib)
c.rets = append(c.rets, ret)
Expand Down

0 comments on commit f60ce19

Please sign in to comment.