Skip to content

Commit ae1565d

Browse files
authored
feat(issue-739): add ACLSetUser to rueidiscompat (#746)
Signed-off-by: astorig <[email protected]>
1 parent e3091a3 commit ae1565d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

rueidiscompat/adapter.go

+7
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ type CoreCmdable interface {
416416

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

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

3212+
func (c *Compat) ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd {
3213+
cmd := c.client.B().AclSetuser().Username(username).Rule(rules...).Build()
3214+
resp := c.client.Do(ctx, cmd)
3215+
return newStatusCmd(resp)
3216+
}
3217+
32113218
func (c *Compat) doPrimaries(ctx context.Context, fn func(c rueidis.Client) error) error {
32123219
if c.pOnly {
32133220
return fn(c.client)

rueidiscompat/pipeline.go

+6
Original file line numberDiff line numberDiff line change
@@ -2095,6 +2095,12 @@ func (c *Pipeline) ACLLog(ctx context.Context, count int64) *ACLLogCmd {
20952095
return ret
20962096
}
20972097

2098+
func (c *Pipeline) ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd {
2099+
ret := c.comp.ACLSetUser(ctx, username, rules...)
2100+
c.rets = append(c.rets, ret)
2101+
return ret
2102+
}
2103+
20982104
func (c *Pipeline) TFunctionLoad(ctx context.Context, lib string) *StatusCmd {
20992105
ret := c.comp.TFunctionLoad(ctx, lib)
21002106
c.rets = append(c.rets, ret)

0 commit comments

Comments
 (0)