Skip to content

Commit 2963a9b

Browse files
committed
Edit README.md
1 parent 38b31af commit 2963a9b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ Stay tuned for upcoming enhancements!
3232
| required | Required |
3333
| optional | Optional |
3434

35+
## Add Custom Validator:
36+
37+
```go
38+
validation.AddCustomValidator("test", "%s vard kon", validateRequired)
39+
40+
func validateRequired(value string, errorMsg string) error {
41+
if value == "" {
42+
fmt.Println(errorMsg)
43+
return errors.New(errorMsg)
44+
}
45+
return nil
46+
}
47+
48+
49+
```
50+
51+
52+
3553
## more
3654

3755
I developed this project to deepen my understanding of Go and its capabilities. It's an opportunity for me to explore Go's features and enhance my skills in building more efficient and flexible systems.

pkg/validation/validator.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ func AddCustomValidator(tagName, message string, fn interface{}) {
138138
data[tagName] = map[string]string{
139139
"error_msg": message,
140140
}
141-
fmt.Println(data)
142141
}
143142

144143
func getMessage(tagName, fieldName string, args ...interface{}) string {

0 commit comments

Comments
 (0)