Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Add more validation methods #5

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

rafaelbreno
Copy link

  • regex
  • in_array

@rafaelbreno
Copy link
Author

I'll be looking forward to add more validation methods, all with tests, there's a huge list of validations that don't need DB connection(while we wait for Generics to develop Eloquent-ish ORM)

@reindert-vetter reindert-vetter self-requested a review February 24, 2021 14:21
Copy link
Contributor

@reindert-vetter reindert-vetter left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

rule/regex.go Outdated Show resolved Hide resolved
rule/regex.go Outdated Show resolved Hide resolved
rule/regex.go Outdated Show resolved Hide resolved
rule/in_array.go Outdated Show resolved Hide resolved
rule/in_array.go Outdated Show resolved Hide resolved
rule/regex.go Outdated Show resolved Hide resolved
@reindert-vetter
Copy link
Contributor

reindert-vetter commented Feb 25, 2021

Good job!

I think method name Match() is a good choice:
rule.Regex{}.Match(...)

I still have doubts about method name InArray():
rule.InArray{}.InArray("not_valid", "invalid", "test_string")
I think it would be nicer to use Array(). That determines what is needed. Or just In(). That reads better.

What are your thoughts on this?

For the rest, I think it's perfect! Do you write the documentation, or should I do that?

@rafaelbreno
Copy link
Author

Good job!

I think method name Match() is a good choice:
rule.Regex{}.Match(...)

I still have doubts about method name InArray():
rule.InArray{}.InArray("not_valid", "invalid", "test_string")
I think it would be nicer to use Array(). That determines what is needed. Or just In(). That reads better.

What are your thoughts on this?

For the rest, I think it's perfect! Do you write the documentation, or should I do that?

Totally agree with you, the naming changes, I'm gonna update, test and commit it, and let me write the documentation for it, would be nice to have participation on the whole process.

@reindert-vetter
Copy link
Contributor

let me write the documentation for it

Perfect 👍. You can choose whether In or Array is better

@rafaelbreno
Copy link
Author

Switched from "InArray()" to "Array()" because there's already a validation method called "In".

err := rule.
    InArray{}.
    Array("not_valid", "invalid", "test_string").
    Verify(support.NewValue("test_string"))

@reindert-vetter
Copy link
Contributor

reindert-vetter commented Mar 13, 2021

@rafaelbreno Have you succeeded in writing documentation yet? You have to say it if I can help you.

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

Successfully merging this pull request may close these issues.

2 participants