customfield

package
v0.0.0-...-b25413d Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrValidatorExists is returned by RegisterValidator when a
	// validator with the same name has already been registered.
	ErrValidatorExists = errors.New("validator already registered")
)

Functions

func RegisterValidator

func RegisterValidator(name string, fn ValidatorFunc) error

RegisterValidator registers a validator under the given name. It returns an error if the name is already registered.

func Registered

func Registered() []string

Registered returns the names of all registered validators.

Types

type ValidatorFunc

type ValidatorFunc func(v any) error

ValidatorFunc validates a value. It should return an error if the value is invalid.

func GetValidator

func GetValidator(name string) (ValidatorFunc, bool)

GetValidator retrieves a validator by name.

type ValidatorPlugin

type ValidatorPlugin interface {
	Name() string
	Validate(v any) error
}

ValidatorPlugin is implemented by runtime validator plugins.

Jump to

Keyboard shortcuts

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