Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test-cover:

.PHONY: test-bench
test-bench:
@go test -run=Bench -bench=. -benchtime 5000000x
@go test -run=Bench -bench=. -benchtime 5000000x -run=^#

.PHONY: build
build:
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The validator covers the specifications, and its respective validations accordin
- [Quick Start Guide](#quick-start-guide)
- [Features](#features)
- [Validations Supported](#validations-supported)
- [Contributing](#contributing)

---

Expand Down Expand Up @@ -89,3 +90,7 @@ func main() {
| 11 | pattern | string | ✅ |
| 11 | notnull | string | ✅ |
| 12 | enum | all | ✅ |

### Contributing
We welcome contributions to the project. If you find a bug or would like to request a new feature, please open an issue
on [GitHub](https://github.com/neo7337/go-struct-validator/issues).
4 changes: 2 additions & 2 deletions constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func notnull(field field, param string) error {
if err != nil {
return fmt.Errorf(ErrBadConstraint, "notnull", param, field.name)
}
if c == true {
if c {
in, _ := field.value.Interface().(string)
if in == "" {
return fmt.Errorf(ErrNotNull, field.name)
Expand Down Expand Up @@ -128,7 +128,7 @@ func enum(field field, param string) error {
flag = checkIfEnumExists(input, param, ",")
}

if flag == false {
if !flag {
return fmt.Errorf(ErrEnums, field.name)
}
return nil
Expand Down