validates

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Feature

func Feature(config ...func(installer *Installer)) miruken.Feature

Feature creates and configures validation support.

func Groups

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

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) New

func (b *Builder) New() *It

func (*Builder) Target

func (b *Builder) Target(
	target any,
) *Builder

type Group

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

Group marks a set of related validations.

func (*Group) InitWithTag

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

func (*Group) Merge

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

func (*Group) Required

func (g *Group) Required() bool

func (*Group) Satisfies

func (g *Group) Satisfies(required miruken.BindingConstraint) bool

type Installer

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

Installer enables validation support.

func (*Installer) Install

func (v *Installer) Install(setup *miruken.SetupBuilder) error

func (*Installer) Output

func (v *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 Validate

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

Validate initiates validation of the `target`.

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 Provider

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

Provider is a FilterProvider for validation.

func (*Provider) AppliesTo

func (p *Provider) AppliesTo(
	callback miruken.Callback,
) bool

func (*Provider) Filters

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

func (*Provider) InitWithTag

func (p *Provider) InitWithTag(tag reflect.StructTag) error

func (*Provider) Required

func (p *Provider) Required() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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