simplvalidator

package module
v0.0.0-...-4831c4a Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 3 Imported by: 0

README

simplvalidator

Golang package provides helper functions for commonly use validations that we do in our projects

Features

  • Simple ,as the name says, It has simple yet robust logic and intiutive function names.
  • You can fork this project and extend according to your needs and use it in your projects/organisations.
  • Functions specific for Indian use 🇮🇳🇮🇳 (More will be added PR's are welcome).
  • Validated against test cases.

Usage

    import "github.com/VarthanV/simplvalidator"

    func main() {
	email := "foo@gmail.com"
	if ok := IsEmail(email); ok {
		// Business logic
	}
}

TODO

[] Add test cases for all the functions
[] Comprehensive documentation
[] Add more validation functions

PRS are welcome !

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlphaNumeric

func IsAlphaNumeric(value string) bool

Checks if the given value is alphanumeric and doesnt have any special characters

func IsAlphabet

func IsAlphabet(value string) bool

Checks if the given value only contains alphabets

func IsEmail

func IsEmail(value string) bool

Checks if the given value is a valid email

func IsEmpty

func IsEmpty(value string) bool

Checks if the given value is empty or not (ie) == ""

func IsEqualTo

func IsEqualTo(value string, length int) bool

Checks if the length of the given value is grrater than or equal to the length(arg)

func IsLengthGreater

func IsLengthGreater(value string, length int) bool

Checks if the length of the value is greater than the length(arg)

func IsLengthGreaterThanOrEqualTo

func IsLengthGreaterThanOrEqualTo(value string, length int) bool

Checks if the length of the given value is grrater than or equal to the length(arg)

func IsLengthLessThanOrEqualTo

func IsLengthLessThanOrEqualTo(value string, length int) bool

Checks if the length of the given value is grrater than or equal to the length(arg)

func IsLengthLesser

func IsLengthLesser(value string, length int) bool

Checks if the length of of the given value is lesser than the length(arg)

func IsNegative

func IsNegative(num int) bool

Checks if the given number is negative

func IsPositive

func IsPositive(num int) bool

Checks if the given number is positivie

func IsURL

func IsURL(value string) bool

Checks if the given value is a URL

func IsValidAadhar

func IsValidAadhar(value string) bool

Checks if the given value is in the valid format for Aadhar card

func IsValidIndianPhoneNumber

func IsValidIndianPhoneNumber(value string) bool

Checks if the given value is a valid form for a Indian Phone Number

func IsValidPAN

func IsValidPAN(value string) bool

Checks if the given value is in the valid format of PAN card

Types

This section is empty.

Jump to

Keyboard shortcuts

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