validator

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: MIT Imports: 2 Imported by: 0

README

Go Validator

This is an extended package of go-playground for Logiqits internal projects.

How to use

Use go get

github.com/logiqbits/go-validator

Then import package

import github.com/logiqbits/validator

Example

type User struct {
    ID    int    `validate:"gt=0"`
    Phone string `validate:"bdmobilephone"`
}

u1 := &User{ID: 1, Phone: "01711223344"}

validation := validator.NewValidator()
err := validation.Struct(u1)
if err != nil {
    fmt.Errorf("Error %v", err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidBDMobilePhoneNumber

func IsValidBDMobilePhoneNumber(field lib.FieldLevel) bool

Types

type Validator

type Validator struct {
	*lib.Validate
}

func NewValidator

func NewValidator() *Validator

Jump to

Keyboard shortcuts

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