validator

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: BSD-3-Clause, BSD-3-Clause Imports: 2 Imported by: 0

README

Validator

It is a package that provides functionality to perform simple validation

import

import (
    "github.com/start-codex/utils/validator"
)

Validate Email

email := validator.Email("test@user.com")

if email.IsValid() {
    fmt.Println("Email is valid")
} else {
    fmt.Println("Email is invalid")
}

Documentation

Index

Constants

View Source
const (
	NameOrLastnameRegexp = `^[a-zA-ZáéíóúÁÉÍÓÚñÑüÜ' -]{2,50}$`
	PasswordRegexp       = `[@[\]^_!"#$%&'()*+,-./:;{}<>|=~?]`
)
View Source
const (
	EmailRegexp = `^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$`
)

Variables

This section is empty.

Functions

func IsEmail added in v0.1.0

func IsEmail(value string) bool

func IsNameOrLastname added in v0.1.0

func IsNameOrLastname(value string) bool

func IsValidPassword added in v0.1.0

func IsValidPassword(password string) bool

IsValidPassword validate password with the following criteria

* They must contain both uppercase and lowercase letters.

* They must contain numbers and special signs.

* They must be a minimum of 8 characters.

* Specific list of allowed special characters: @ [ ] ^ _ ! " # $ % & ' ( ) * + , - . / : ; { } < > = | ~ ?

func Regexp added in v0.1.0

func Regexp(value, regex string) bool

Types

type Email

type Email string

func (Email) IsValid

func (e Email) IsValid() bool

func (Email) String

func (e Email) String() string

Jump to

Keyboard shortcuts

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