playvalidator

package
v0.30.17 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Feature

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

Types

type Installer

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

Installer integrates validation support for the go playground validator. https://github.com/go-playground/validator/

func (*Installer) DependsOn

func (v *Installer) DependsOn() []miruken.Feature

func (*Installer) Install

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

func (*Installer) UseTranslator

func (v *Installer) UseTranslator(translator ut.Translator)

func (*Installer) Validator

func (v *Installer) Validator() *play.Validate

type Rules

type Rules []struct {
	Type        any
	Constraints map[string]string
}

Rules express the validation constraints explicitly without depending on validation struct tags.

type Validator

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

Validator provides core validation behavior.

func (*Validator) ConstructWithRules

func (v *Validator) ConstructWithRules(
	rules Rules,
	configure func(*play.Validate) error,
	translator ut.Translator,
) error

func (*Validator) Constructor

func (v *Validator) Constructor(
	validate *play.Validate,
	_ *struct{ args.Optional }, translator ut.Translator,
)

func (*Validator) Validate

func (v *Validator) Validate(
	target any,
	outcome *validates.Outcome,
) miruken.HandleResult

func (*Validator) ValidateAndStop

func (v *Validator) ValidateAndStop(
	target any,
	outcome *validates.Outcome,
) miruken.HandleResult

type ValidatorT added in v0.25.0

type ValidatorT[T any] struct {
	Validator
}

ValidatorT extends validation for a specific type.

func (*ValidatorT[T]) Validate added in v0.25.0

func (v *ValidatorT[T]) Validate(
	validate *validates.It, t T,
) miruken.HandleResult

Jump to

Keyboard shortcuts

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