verno

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

README

Overview

This package takes Go playground validator's validation error and spits a Go map containing the errors in a way that can be marshalled into JSON.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(err error) error

Types

type Error

type Error struct {
	Type  string
	Field string
	Path  string
	Param string
	Value any
}

func (*Error) Error

func (err *Error) Error() string

func (*Error) MarshalJSON

func (err *Error) MarshalJSON() ([]byte, error)

func (*Error) Translate

func (err *Error) Translate(tr TranslatorFunc) any

type Map

type Map map[string]Validation

func (Map) Error

func (err Map) Error() string

func (Map) Translate

func (err Map) Translate(tr TranslatorFunc) any

type Slice

type Slice []Validation

func NewSlice

func NewSlice(length, capacity int) Slice

func (Slice) Error

func (err Slice) Error() string

func (Slice) Translate

func (err Slice) Translate(tr TranslatorFunc) any

type TranslatorFunc

type TranslatorFunc func(Error) string

type Validation

type Validation interface {
	error
	Translate(TranslatorFunc) any
	// contains filtered or unexported methods
}

func New

func New(field, err string) Validation

Jump to

Keyboard shortcuts

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