validators

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package validators specifies that the variables, constants and functions to validate form data.

Index

Constants

View Source
const EmailPattern = "" /* 130-byte string literal not displayed */

EmailPattern stores a regular expression to validate the email address.

View Source
const NamePattern = "^[A-Za-z ]{5,}$"

NamePattern stores a regular expression to validate the name.

Variables

This section is empty.

Functions

func Email

func Email(s string) bool

Email validates s email against the EMAIL_PATTERN set in the constant.

func Empty

func Empty(s string) bool

Empty validates s value by checking if it is blank.

func IntegerInRange

func IntegerInRange(s string, min int, max int) (error, bool)

IntegerInRange validates if s contains integral value, and its value lies between min and max values. This function returns error if s is non-integral.

func IsInteger

func IsInteger(s string) bool

IsInteger validates if s contains integral value.

func LengthInRange

func LengthInRange(s string, min int, max int) bool

LengthInRange validates if the length s is between specified min and max value.

func MaxLength

func MaxLength(s string, max int) bool

MaxLength validates if the length s is smaller than or equal to the specified max value.

func MinLength

func MinLength(s string, min int) bool

MinLength validates if the length of s is greater than or equal to the specified min value.

func NotBlank

func NotBlank(data interface{}) bool

NotBlank is the validation function for validating if the current field has a value or length greater than zero, or is not a space only string.

func Password

func Password(s string) bool

Password validates s password against the rules defined below.

upp: at least one upper case letter. low: at least one lower case letter. num: at least one digit. sym: at least one special character. tot: at least eight characters long. No empty string or whitespace.

Types

This section is empty.

Jump to

Keyboard shortcuts

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