validates

package
v0.30.112 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Feature

func Feature(config ...func(*Installer)) setup.Feature

Feature creates and configures validation support.

func Groups

func Groups(groups ...any) miruken.Constraint

Groups builds a validation Group constraint.

func Output

func Output(installer *Installer)

Types

type Builder

type Builder struct {
	miruken.CallbackBuilder
	// contains filtered or unexported fields
}

Builder builds It callbacks.

func (*Builder) ForSource added in v0.30.1

func (b *Builder) ForSource(
	source any,
) *Builder

func (*Builder) New

func (b *Builder) New() *It

type Group

type Group struct {
	// contains filtered or unexported fields
}

Group marks a set of related validations.

func (*Group) Implied added in v0.28.0

func (g *Group) Implied() bool

func (*Group) InitWithTag

func (g *Group) InitWithTag(tag reflect.StructTag) error

func (*Group) Merge

func (g *Group) Merge(constraint miruken.Constraint) bool

func (*Group) Required

func (g *Group) Required() bool

func (*Group) Satisfies

func (g *Group) Satisfies(required miruken.Constraint, _ miruken.Callback) bool

type Installer

type Installer struct {
	// contains filtered or unexported fields
}

Installer enables validation support.

func (*Installer) Install

func (i *Installer) Install(b *setup.Builder) error

func (*Installer) Output

func (i *Installer) Output()

type It

type It struct {
	miruken.CallbackBase
	// contains filtered or unexported fields
}

It validates callbacks contravariantly.

func (*It) Dispatch

func (v *It) Dispatch(
	handler any,
	greedy bool,
	composer miruken.Handler,
) miruken.HandleResult

func (*It) Groups

func (v *It) Groups() []any

func (*It) InGroup

func (v *It) InGroup(group any) bool

func (*It) Key

func (v *It) Key() any

func (*It) Outcome

func (v *It) Outcome() *Outcome

func (*It) Policy

func (v *It) Policy() miruken.Policy

func (*It) Source

func (v *It) Source() any

func (*It) String

func (v *It) String() string

type Outcome

type Outcome struct {
	// contains filtered or unexported fields
}

Outcome captures structured validation errors.

func Constraints added in v0.30.1

func Constraints(
	handler miruken.Handler,
	source any,
	constraints ...any,
) (o *Outcome, po *promise.Promise[*Outcome], err error)

Constraints performs all validations on `source`.

func (*Outcome) AddError

func (o *Outcome) AddError(
	path string,
	err error,
)

func (*Outcome) Error

func (o *Outcome) Error() string

func (*Outcome) FieldErrors

func (o *Outcome) FieldErrors(
	path string,
) []error

func (*Outcome) Fields

func (o *Outcome) Fields() []string

func (*Outcome) Path

func (o *Outcome) Path(
	path string,
) *Outcome

func (*Outcome) RequirePath

func (o *Outcome) RequirePath(
	path string,
) *Outcome

func (*Outcome) Valid

func (o *Outcome) Valid() bool

type Required added in v0.30.6

type Required struct {
	// contains filtered or unexported fields
}

Required is a FilterProvider for validation.

func (*Required) AppliesTo added in v0.30.6

func (r *Required) AppliesTo(
	callback miruken.Callback,
) bool

func (*Required) Filters added in v0.30.6

func (r *Required) Filters(
	binding miruken.Binding,
	callback any,
	composer miruken.Handler,
) ([]miruken.Filter, error)

func (*Required) InitWithTag added in v0.30.6

func (r *Required) InitWithTag(tag reflect.StructTag) error

func (*Required) Required added in v0.30.6

func (r *Required) Required() bool

func (*Required) ValidateOutput added in v0.30.6

func (r *Required) ValidateOutput() bool

type Strict added in v0.25.0

type Strict = miruken.Strict

Strict alias for validation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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