validation

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchPattern added in v0.2.3

func MatchPattern(pattern string, value string) (bool, error)

MatchPattern reports whether value matches pattern from start to end.

func ValidatePattern added in v0.2.3

func ValidatePattern(pattern string) error

ValidatePattern reports whether pattern uses the generated action validation syntax supported by MatchPattern.

Types

type Error

type Error struct {
	Field   string
	Message string
}

Error describes one validation failure.

type Result

type Result struct {
	Errors []Error
}

Result collects validation errors for generated actions.

func (*Result) Add

func (result *Result) Add(field, message string)

Add records a validation failure.

func (Result) ByField

func (result Result) ByField() map[string][]string

ByField groups validation messages by field while preserving message order.

func (Result) FieldMessages

func (result Result) FieldMessages(field string) []string

FieldMessages returns messages for one submitted field.

func (Result) Messages

func (result Result) Messages() []string

Messages returns validation messages in insertion order.

func (Result) OK

func (result Result) OK() bool

OK reports whether no validation failures were recorded.

Jump to

Keyboard shortcuts

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