Discover Packages
github.com/parvez0/wabacli
pkg
utils
validator
package
Version:
v0.0.21
Opens a new window with list of versions in this module.
Published: Mar 29, 2021
License: Apache-2.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
func Validate(data interface{}) []error
Validate takes an interface as input and get the tags of each fields
after processing the tags it will get a appropriate validator and
calls the validate func
type RequiredFields struct{}
RequiredFields is a type of validator which validates fields with
tag required, and it throws and error if the value is empty
Type custom type for different validator names
const (
TagName Type = "validate"
FieldRequired Type = "required"
)
type Validator interface {
Validate(string , interface{}) error
}
Validator provides an interface for all the different
types of validators, all those should implement the method
validate
Source Files
¶
Click to show internal directories.
Click to hide internal directories.