validate

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 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 NonEmptyValidator

type NonEmptyValidator struct{}

NonEmptyValidator checks that the input is not empty after trimming

func (NonEmptyValidator) Validate

func (v NonEmptyValidator) Validate(input string) error

Validate checks the input and return an error if its invalid

type NumericRangeValidator

type NumericRangeValidator struct {
	Min int
	Max int
}

NumericRangeValidator checks that the input is a valid number after trimming and its value is between a given range

func (NumericRangeValidator) Validate

func (v NumericRangeValidator) Validate(input string) error

Validate checks the input and return an error if its invalid

type RegexValidator

type RegexValidator struct {
	Pattern string
}

RegexValidator checks that the input matches a pattern after trimming

func (RegexValidator) Validate

func (v RegexValidator) Validate(input string) error

Validate checks the input and return an error if its invalid

type Validator

type Validator interface {
	Validate(string) error
}

Validator defines the behaviour validation behaviour

Jump to

Keyboard shortcuts

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