validate

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func(input string) error

Func determines if the input string is valid, returning nil if valid or an error if invalid

func NewValidation

func NewValidation() Func

NewValidation creates the initial chain for validations

func (Func) And

func (fn Func) And(other Func) Func

And allows chaining another *required* validation function to the end of other functions in the chain

func (Func) Build

func (fn Func) Build() func(string) error

Build returns the raw underlying functional type

func (Func) Contains

func (fn Func) Contains(value string, msgAndArgs ...any) Func

Contains defines a substring which is required in the target input

func (Func) Matches

func (fn Func) Matches(pattern string, msgAndArgs ...any) Func

Matches defines the pattern required for the targeted input

func (Func) MaxLength

func (fn Func) MaxLength(length int, msgAndArgs ...any) Func

MaxLength defines the maximum allowed length (in runes)

func (Func) MinLength

func (fn Func) MinLength(length int, msgAndArgs ...any) Func

MinLength defines the minimum allowed length (in runes)

func (Func) Or

func (fn Func) Or(other Func) Func

Or allows defining a different validation to invoke when the first validation was successful.

Jump to

Keyboard shortcuts

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