contract

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constraint

type Constraint interface {
	Validate(value any, field string) ValidationError
}

type ParameterizedConstraint added in v2.9.0

type ParameterizedConstraint interface {
	Constraint

	WithParams(params map[string]string) (Constraint, error)
}

ParameterizedConstraint is implemented by constraints that accept tag parameters (for example min(value=2)). WithParams returns a NEW constraint configured from the given parameters and must not mutate the receiver; a rule whose parameters cannot be consumed fails closed.

type ValidationError

type ValidationError interface {
	Field() string

	Message() string

	Code() string

	Context() map[string]any

	Error() string
}

Jump to

Keyboard shortcuts

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