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

Add RequireAll function & test #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add RequireAll function & test #5

wants to merge 1 commit into from

Conversation

DaniilDaedalus
Copy link

Simple multiple arguments Require(). Not sure if RequireAll must return *ValidationResult. RequireAll() might also replace Require() without breaking compatibility.

func (v *Validator) RequireAll(fields ...string) {
for _, field := range fields {
v.Require(field)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like we would want to have a return value for this since Require has one... would it make sense to have this signature be:

func (v *Validator) RequireAll(fields ...string) ([]*ValidationResult, bool) {
  // ...
}

where the boolean return value indicates validity of the set, while the slice would provide access to the results?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants