rules

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptedRule

func AcceptedRule(field string, value interface{}, params []string, data map[string]interface{}) error

AcceptedRule validates that a field is accepted (yes, on, 1, true)

func AlphaDashRule

func AlphaDashRule(field string, value interface{}, params []string, data map[string]interface{}) error

AlphaDashRule validates that a value contains only alpha-numeric characters, dashes, and underscores

func AlphaNumRule

func AlphaNumRule(field string, value interface{}, params []string, data map[string]interface{}) error

AlphaNumRule validates that a value contains only alpha-numeric characters

func AlphaRule

func AlphaRule(field string, value interface{}, params []string, data map[string]interface{}) error

AlphaRule validates that a value contains only alphabetic characters

func ArrayRule

func ArrayRule(field string, value interface{}, params []string, data map[string]interface{}) error

ArrayRule validates that a value is an array

func BetweenRule

func BetweenRule(field string, value interface{}, params []string, data map[string]interface{}) error

BetweenRule validates that a value is between min and max

func BooleanRule

func BooleanRule(field string, value interface{}, params []string, data map[string]interface{}) error

BooleanRule validates that a value is a boolean

func ConfirmedRule

func ConfirmedRule(field string, value interface{}, params []string, data map[string]interface{}) error

ConfirmedRule validates that a field has a matching _confirmation field

func DifferentRule

func DifferentRule(field string, value interface{}, params []string, data map[string]interface{}) error

DifferentRule validates that a field is different from another field

func EmailRule

func EmailRule(field string, value interface{}, params []string, data map[string]interface{}) error

EmailRule validates that a value is a valid email using both regex and net/mail.ParseAddress

func InRule

func InRule(field string, value interface{}, params []string, data map[string]interface{}) error

InRule validates that a value is in a list of allowed values

func IntegerRule

func IntegerRule(field string, value interface{}, params []string, data map[string]interface{}) error

IntegerRule validates that a value is an integer

func MaxRule

func MaxRule(field string, value interface{}, params []string, data map[string]interface{}) error

MaxRule validates maximum length/size

func MinRule

func MinRule(field string, value interface{}, params []string, data map[string]interface{}) error

MinRule validates minimum length/size

func NotInRule

func NotInRule(field string, value interface{}, params []string, data map[string]interface{}) error

NotInRule validates that a value is not in a list of values

func NumericRule

func NumericRule(field string, value interface{}, params []string, data map[string]interface{}) error

NumericRule validates that a value is numeric

func SameRule

func SameRule(field string, value interface{}, params []string, data map[string]interface{}) error

SameRule validates that a field matches another field

func SizeRule

func SizeRule(field string, value interface{}, params []string, data map[string]interface{}) error

SizeRule validates exact size

func StringRule

func StringRule(field string, value interface{}, params []string, data map[string]interface{}) error

StringRule validates that a value is a string

func URLPublicRule added in v0.9.2

func URLPublicRule(field string, value interface{}, params []string, data map[string]interface{}) error

URLPublicRule validates that a value is a valid URL pointing to a public (non-internal) host. Rejects private/internal IPs (127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, ::1, fc00::/7).

func URLRule

func URLRule(field string, value interface{}, params []string, data map[string]interface{}) error

URLRule validates that a value is a valid URL

Types

This section is empty.

Jump to

Keyboard shortcuts

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