validation

package
v0.0.0-...-91b8838 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package validation provides methods to validate the various models for this project.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyUid error for empty uid
	ErrEmptyUid = errors.New("uid cannot be empty")
	// ErrEmptyName error for empty name
	ErrEmptyName = errors.New("name cannot be empty")
	// ErrEmptyEmail error for empty email
	ErrEmptyEmail = errors.New("email cannot be empty")
	// ErrEmptyPassword error for empty password
	ErrEmptyPassword = errors.New("password cannot be empty")
	// ErrEmptyTitle error for empty Title
	ErrEmptyTitle = errors.New("title cannot be empty")
	// ErrEmptyDescription error for empty Description
	ErrEmptyDescription = errors.New("description cannot be empty")
	// ErrEmptyMsg error for empty Msg
	ErrEmptyMsg = errors.New("message cannot be empty")
	// ErrInvalidEmail error for invalid email
	ErrInvalidEmail = errors.New("email not valid")
	// ErrEmailExists error for email already exists
	ErrEmailExists = errors.New("email already exists")
	// ErrNameExists error for name already exists
	ErrNameExists = errors.New("name already exists")
	// ErrNotFound error for not found
	ErrNotFound = errors.New("resource not found")
	// ErrInvalidPassword error for invalid password
	ErrInvalidPassword = errors.New("invalid password, 8-50 characters, one upper, lower, number and special character")
)

Functions

func IsEmptyString

func IsEmptyString(in string) bool

IsEmptyString verifies if a string is empty

func IsValidEmail

func IsValidEmail(email string) bool

IsValidEmail verifies if an email is valid

func IsValidForum

func IsValidForum(forum *pb.Forum) error

IsValidForum verifies the given forum is valid.

func IsValidPassword

func IsValidPassword(s string) bool

IsValidPassword verifies if a password is valid

func IsValidPlace

func IsValidPlace(place *pb.Place) error

IsValidPlace verifies the given place is valid.

func IsValidPost

func IsValidPost(post *pb.Post) error

IsValidPost verifies the given post is valid.

func IsValidSignUp

func IsValidSignUp(user *pb.User) error

IsValidSignUp takes a *SignUpRequest and verifies if the request is valid

func IsValidThread

func IsValidThread(thread *pb.Thread) error

IsValidThread verifies the given thread is valid.

func NormalizeEmail

func NormalizeEmail(email string) string

NormalizeEmail normalizes email string

Types

This section is empty.

Jump to

Keyboard shortcuts

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