internal

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDirective = errors.New("malformed directive")

ErrDirective indicates a malformed or misapplied dv8 directive: a bug in the tag, not in the data.

Functions

func Compile added in v0.3.0

func Compile(refType reflect.Type) error

Compile validates the dv8 directives declared on a type, recursing into nested types. Errors wrap ErrDirective. The result is cached per type.

func Validate

func Validate(ctx context.Context, data any) error

Validate takes in a reference to a data struct (pointer, map of, slice of) and validates each of its fields against their dv8 field tags. It recurses into nested structs. A nil ctx is tolerated and replaced with context.Background.

Types

type Validator added in v0.1.4

type Validator interface {
	Validate(ctx context.Context) error
}

Validator implements a single method that returns an error if a struct is invalid. DV8 calls this method during validation on any type in the object graph that implements it.

Jump to

Keyboard shortcuts

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