Help us shape the future of Go! Take the 2026 Go Developer Survey

validation

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddValidationError

func AddValidationError(ctx context.Context, err error)

func ContextWithValidationContext

func ContextWithValidationContext(ctx context.Context) context.Context

func GetContextObject

func GetContextObject[T any](o *Options) *T

func GetValidationErrors

func GetValidationErrors(ctx context.Context) []error

Types

type Error

type Error struct {
	Line    int
	Column  int
	Message string
}

Error represents a validation error and the line and column where it occurred TODO allow getting the JSON path for line/column for validation errors

func (Error) Error

func (e Error) Error() string

type Option

type Option func(o *Options)

func WithContextObject

func WithContextObject[T any](obj *T) Option

type Options

type Options struct {
	ContextObjects map[reflect.Type]any
}

func NewOptions

func NewOptions(opts ...Option) *Options

Jump to

Keyboard shortcuts

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