Conditions | 1 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | package validation_test |
||
27 | func ExampleConditionalConstraint_Else() { |
||
28 | v := "123" |
||
29 | err := validator.ValidateString( |
||
30 | &v, |
||
31 | validation.When(false). |
||
32 | Then( |
||
33 | it.Matches(regexp.MustCompile(`^\w+$`)), |
||
34 | ). |
||
35 | Else( |
||
36 | it.Matches(regexp.MustCompile(`^\d+$`)), |
||
37 | ), |
||
38 | ) |
||
39 | fmt.Println(err) |
||
40 | // Output: |
||
43 |