validator

package
v0.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Package validator has functions to help to validate structures and fields for ShellHub.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFields = errors.New("invalid fields")

Functions

func FormatUser added in v0.8.0

func FormatUser(user *models.User)

FormatUser apply some formation rules to a models.User and encrypt the password.

func GetInvalidFieldsValues added in v0.9.2

func GetInvalidFieldsValues(err error) (map[string]interface{}, error)

GetInvalidFieldsValues receive a structure validation error and return a map with invalid fields and values.

func HashPassword added in v0.8.0

func HashPassword(password string) string

func ValidateField added in v0.9.1

func ValidateField(structure interface{}, field, value string) bool

ValidateField validates if a structure's field is valid.

func ValidateFieldEmail added in v0.9.0

func ValidateFieldEmail(email string) bool

ValidateFieldEmail validate the data for the field Email from structure models.UserData.

func ValidateFieldPassword added in v0.9.0

func ValidateFieldPassword(password string) bool

ValidateFieldPassword validate the data for the field Password from structure models.UserPassword.

func ValidateFieldTag added in v0.9.0

func ValidateFieldTag(tag string) bool

ValidateFieldTag validate the data for the field Tag from structure models.Device.

func ValidateFieldUsername added in v0.9.0

func ValidateFieldUsername(username string) bool

ValidateFieldUsername validate the data for the field Username from structure models.UserData.

func ValidateStruct added in v0.7.3

func ValidateStruct(data interface{}) ([]string, error)

func ValidateStructFields added in v0.9.2

func ValidateStructFields(data interface{}) (map[string]interface{}, error)

func ValidateVar added in v0.7.3

func ValidateVar(data interface{}, tag string) ([]string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL