-
Notifications
You must be signed in to change notification settings - Fork 944
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
Feature/validate role options #101
Conversation
Only accept CREATE ROLE flags that doesn't have any params (i.e. not ADMIN or CONNECTION LIMIT). Check that both flag and NOflag are not used at the same time.
pkg/cluster/util.go
Outdated
func invertFlag(flag string) string { | ||
if flag[:2] == "NO" { | ||
return flag[2:] | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for else
pkg/cluster/util.go
Outdated
return "NO" + flag | ||
} | ||
} | ||
|
||
func normalizeUserFlags(userFlags []string) (flags []string, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in this case there is no strong need for the named return values.
Besides, code like return nil, fmt.Errorf("bla")
as for me looks more clear than
err = fmt.Errorf("bla")
return
👍 |
👍 |
Only accept CREATE ROLE flags that doesn't have any params (i.e.
not ADMIN or CONNECTION LIMIT). Check that both flag and NOflag
are not used at the same time.