-
-
Save long25vn/bea586b52f8d2eaf38b306b991c19347 to your computer and use it in GitHub Desktop.
Validation rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type User struct { | |
Email string `json:"email" validate:"required,email"` | |
Name string `json:"name" validate:"required,min=2,max=100"` | |
} | |
func main() { | |
u := User{} | |
err := validate.Validate(a) | |
fmt.Fatal(err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment