validator

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package validator provides convenient utilities for validation using https://github.com/go-playground/validator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *validate.Validate

New return instance of validator

func RegisterValidation

func RegisterValidation(tag string, fn validate.Func, callValidationEvenIfNull bool) error

RegisterValidation adds a validation with the given tag

NOTES: - if the key already exists, the previous validation function will be replaced. - this method is not thread-safe it is intended that these all be registered prior to any validation

func Validate

func Validate(v interface{}) error

Validate the given struct base on the definition of 'validate' tag of the struct.

func Var added in v0.1.0

func Var(field interface{}, tag string) error

Var validates a single variable using tag style validation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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