validation

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError is returned when input fails validation.

func ARN

func ARN(field, value string) *ValidationError

ARN validates an ARN format (arn:partition:service:region:account:resource).

func CIDR

func CIDR(field, value string) *ValidationError

CIDR validates a CIDR block format.

func InRange

func InRange(field string, value, min, max int) *ValidationError

InRange checks an integer is within bounds (inclusive).

func MaxLength

func MaxLength(field, value string, max int) *ValidationError

MaxLength checks maximum string length.

func MinLength

func MinLength(field, value string, min int) *ValidationError

MinLength checks minimum string length.

func Name

func Name(field, value string) *ValidationError

Name validates a typical AWS resource name (alphanumeric, hyphens, underscores, 1-128 chars).

func OneOf

func OneOf(field, value string, allowed []string) *ValidationError

OneOf checks a string is one of the allowed values.

func Pattern

func Pattern(field, value, pattern, description string) *ValidationError

Pattern checks a string matches a regex pattern.

func Required

func Required(field, value string) *ValidationError

Required checks that a string field is non-empty.

func Validate

func Validate(checks ...*ValidationError) *ValidationError

Validate runs multiple checks and returns the first error, or nil.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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