File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -164,13 +164,13 @@ When adding checker struct tags to a slice, you can use the `@` prefix to indica
164
164
``` golang
165
165
type Person struct {
166
166
Name string ` checkers:"required"`
167
- Emails []string ` checkers:"@max-len:1 max-len:4 "`
167
+ Emails []string ` checkers:"@max-len:2 max-len:64 "`
168
168
}
169
169
```
170
170
171
171
In this example:
172
- - ` @max-len:1 ` ensures that the ` Emails ` slice itself has at most one item .
173
- - ` max-len:4 ` ensures that each email string within the ` Emails ` slice has a maximum length of 4 characters.
172
+ - ` @max-len:2 ` ensures that the ` Emails ` slice itself has at most two items .
173
+ - ` max-len:64 ` ensures that each email string within the ` Emails ` slice has a maximum length of 64 characters.
174
174
175
175
# Localized Error Messages
176
176
@@ -192,7 +192,7 @@ checker.RegisterLocale(locales.DeDE, locales.DeDEMessages)
192
192
193
193
_ , err := checker.IsEmail (" abcd" )
194
194
if err != nil {
195
- fmt.Println (err)
195
+ fmt.Println (err. ErrorWithLocale (locales. DeDE ) )
196
196
// Output: Keine gültige E-Mail-Adresse.
197
197
}
198
198
```
@@ -217,7 +217,7 @@ Error messages are generated using Golang template functions, allowing them to i
217
217
err := NewCheckErrorWithData (
218
218
" NOT_FRUIT" ,
219
219
map [string ]interface {}{
220
- " name" : name ,
220
+ " name" : " abcd " ,
221
221
},
222
222
)
223
223
You can’t perform that action at this time.
0 commit comments