validator

package
v0.0.0-...-88dbfc4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validation

type Validation struct {
	// contains filtered or unexported fields
}

func NewValidation

func NewValidation() *Validation

func (*Validation) GetJSON

func (v *Validation) GetJSON(structure interface{}, w http.ResponseWriter, r *http.Request, log *logrus.Logger) error

Helper that decodes and validates incoming JSON request body

func (*Validation) Validate

func (v *Validation) Validate(i interface{}) ValidationErrors

type ValidationError

type ValidationError struct {
	validator.FieldError
}

ValidationError wraps the validators FieldError so we do not expose this

func (ValidationError) Error

func (v ValidationError) Error() string

type ValidationErrorResp

type ValidationErrorResp struct {
	Messages []string `json:"messages"`
}

ValidationError is a collection of validation error messages

type ValidationErrors

type ValidationErrors []ValidationError

func (ValidationErrors) Errors

func (v ValidationErrors) Errors() []string

Errors converts the slice into a string slice

Jump to

Keyboard shortcuts

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