validator

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelValidator

type ModelValidator interface {
	IsValid() bool
	Validate() error
}

ModelValidator is the interface to validate model objects

type ModelValidatorObj

type ModelValidatorObj struct {
	Obj       model.Model
	Validator *validator.Validate
}

ModelValidatorObj implements the ModelValidator per default

func NewModelValidator

func NewModelValidator(obj model.Model) *ModelValidatorObj

NewModelValidator creates an new pointer instance of ModelValidatorObj with default values

func (*ModelValidatorObj) IsValid

func (v *ModelValidatorObj) IsValid() bool

IsValid check if v.Validate() returns any error or not

func (*ModelValidatorObj) Validate

func (v *ModelValidatorObj) Validate() error

Validate runs the validations in the v.Obj (if defined) TODO: Add custom error message here

Jump to

Keyboard shortcuts

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