validation

package
v0.126.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package validation provides struct-tag validation helpers and custom validator registration for internal config types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterValidationFunc

func RegisterValidationFunc(tag string, fn Func) error

RegisterValidationFunc registers a custom validation tag for use in struct field tags.

func Validate

func Validate(v any) error

Validate applies validator rules, custom tag handlers, and scalar value validation.

Types

type Func

type Func func(v any, param string) error

Func adapts custom field validation to the tag+parameter shape used in struct tags.

type TextError

type TextError struct {
	Err error
}

func (TextError) Error

func (e TextError) Error() string

Error returns the wrapped error text.

func (TextError) Unwrap

func (e TextError) Unwrap() error

Unwrap exposes the wrapped error for errors.Is and errors.As.

type ValueValidator added in v0.125.0

type ValueValidator interface {
	ValidateValue() error
}

ValueValidator lets scalar configuration types validate themselves without a struct tag.

Jump to

Keyboard shortcuts

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