Skip to content

Commit 575ef70

Browse files
authored
Merge branch 'master' into connection_issue
2 parents 0abdada + 30e7388 commit 575ef70

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3387
-244
lines changed

.github/workflows/spellcheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- name: Checkout
99
uses: actions/checkout@v4
1010
- name: Check Spelling
11-
uses: rojopolis/spellcheck-github-actions@0.45.0
11+
uses: rojopolis/spellcheck-github-actions@0.47.0
1212
with:
1313
config_path: .github/spellcheck-settings.yml
1414
task_name: Markdown

.golangci.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
run:
2-
concurrency: 8
3-
deadline: 5m
2+
timeout: 5m
43
tests: false

acl_commands.go

+54
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@ import "context"
44

55
type ACLCmdable interface {
66
ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd
7+
78
ACLLog(ctx context.Context, count int64) *ACLLogCmd
89
ACLLogReset(ctx context.Context) *StatusCmd
10+
11+
ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd
12+
ACLDelUser(ctx context.Context, username string) *IntCmd
13+
ACLList(ctx context.Context) *StringSliceCmd
14+
15+
ACLCat(ctx context.Context) *StringSliceCmd
16+
ACLCatArgs(ctx context.Context, options *ACLCatArgs) *StringSliceCmd
17+
}
18+
19+
type ACLCatArgs struct {
20+
Category string
921
}
1022

1123
func (c cmdable) ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd {
@@ -33,3 +45,45 @@ func (c cmdable) ACLLogReset(ctx context.Context) *StatusCmd {
3345
_ = c(ctx, cmd)
3446
return cmd
3547
}
48+
49+
func (c cmdable) ACLDelUser(ctx context.Context, username string) *IntCmd {
50+
cmd := NewIntCmd(ctx, "acl", "deluser", username)
51+
_ = c(ctx, cmd)
52+
return cmd
53+
}
54+
55+
func (c cmdable) ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd {
56+
args := make([]interface{}, 3+len(rules))
57+
args[0] = "acl"
58+
args[1] = "setuser"
59+
args[2] = username
60+
for i, rule := range rules {
61+
args[i+3] = rule
62+
}
63+
cmd := NewStatusCmd(ctx, args...)
64+
_ = c(ctx, cmd)
65+
return cmd
66+
}
67+
68+
func (c cmdable) ACLList(ctx context.Context) *StringSliceCmd {
69+
cmd := NewStringSliceCmd(ctx, "acl", "list")
70+
_ = c(ctx, cmd)
71+
return cmd
72+
}
73+
74+
func (c cmdable) ACLCat(ctx context.Context) *StringSliceCmd {
75+
cmd := NewStringSliceCmd(ctx, "acl", "cat")
76+
_ = c(ctx, cmd)
77+
return cmd
78+
}
79+
80+
func (c cmdable) ACLCatArgs(ctx context.Context, options *ACLCatArgs) *StringSliceCmd {
81+
// if there is a category passed, build new cmd, if there isn't - use the ACLCat method
82+
if options != nil && options.Category != "" {
83+
cmd := NewStringSliceCmd(ctx, "acl", "cat", options.Category)
84+
_ = c(ctx, cmd)
85+
return cmd
86+
}
87+
88+
return c.ACLCat(ctx)
89+
}

0 commit comments

Comments
 (0)