validate

package
v0.5.0-rc.9 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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