Documentation ¶
Overview ¶
Package validator has functions to help to validate structures and fields for ShellHub.
Index ¶
- Variables
- func FormatUser(user *models.User)
- func GetInvalidFieldsValues(err error) (map[string]interface{}, error)
- func HashPassword(password string) string
- func ValidateField(structure interface{}, field, value string) bool
- func ValidateFieldEmail(email string) bool
- func ValidateFieldPassword(password string) bool
- func ValidateFieldTag(tag string) bool
- func ValidateFieldUsername(username string) bool
- func ValidateStruct(data interface{}) ([]string, error)
- func ValidateStructFields(data interface{}) (map[string]interface{}, error)
- func ValidateVar(data interface{}, tag string) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFields = errors.New("invalid fields")
Functions ¶
func FormatUser ¶ added in v0.8.0
FormatUser apply some formation rules to a models.User and encrypt the password.
func GetInvalidFieldsValues ¶ added in v0.9.2
GetInvalidFieldsValues receive a structure validation error and return a map with invalid fields and values.
func HashPassword ¶ added in v0.8.0
func ValidateField ¶ added in v0.9.1
ValidateField validates if a structure's field is valid.
func ValidateFieldEmail ¶ added in v0.9.0
ValidateFieldEmail validate the data for the field Email from structure models.UserData.
func ValidateFieldPassword ¶ added in v0.9.0
ValidateFieldPassword validate the data for the field Password from structure models.UserPassword.
func ValidateFieldTag ¶ added in v0.9.0
ValidateFieldTag validate the data for the field Tag from structure models.Device.
func ValidateFieldUsername ¶ added in v0.9.0
ValidateFieldUsername validate the data for the field Username from structure models.UserData.
func ValidateStruct ¶ added in v0.7.3
func ValidateStructFields ¶ added in v0.9.2
func ValidateVar ¶ added in v0.7.3
Types ¶
This section is empty.