validate

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default() *validator.Validate

Default returns the singleton validator instance with all custom validations registered.

func DetailForFirstError

func DetailForFirstError(err error, fallback string, details ...ErrorDetail) string

DetailForFirstError extracts the first validator failure and returns the matching caller-owned detail. It returns fallback for non-validator errors and unmapped failures.

func New

func New() *validator.Validate

New creates a new validator with all custom validations registered. Prefer Default() for typical use cases; use New() for testing or when you need multiple instances.

Types

type ErrorDetail

type ErrorDetail struct {
	Field  string
	Tag    string
	Detail string
}

ErrorDetail maps a validator field/tag pair to a caller-owned error detail. An empty Tag matches any validation tag for the field.

Jump to

Keyboard shortcuts

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