Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ACLSetUser to rueidiscompat #746

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions rueidiscompat/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ type CoreCmdable interface {

ACLDryRun(ctx context.Context, username string, command ...any) *StringCmd
ACLLog(ctx context.Context, count int64) *ACLLogCmd
ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd
// TODO ACLLogReset(ctx context.Context) *StatusCmd

ModuleLoadex(ctx context.Context, conf *ModuleLoadexConfig) *StringCmd
Expand Down Expand Up @@ -3208,6 +3209,12 @@ func (c *Compat) ACLLog(ctx context.Context, count int64) *ACLLogCmd {
return newACLLogCmd(resp)
}

func (c *Compat) ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd {
cmd := c.client.B().AclSetuser().Username(username).Rule(rules...).Build()
resp := c.client.Do(ctx, cmd)
return newStatusCmd(resp)
}

func (c *Compat) doPrimaries(ctx context.Context, fn func(c rueidis.Client) error) error {
if c.pOnly {
return fn(c.client)
Expand Down
6 changes: 6 additions & 0 deletions rueidiscompat/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,12 @@ func (c *Pipeline) ACLLog(ctx context.Context, count int64) *ACLLogCmd {
return ret
}

func (c *Pipeline) ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd {
ret := c.comp.ACLSetUser(ctx, username, rules...)
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