validation

package
v1.39.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StringIsMetroCode      = validation.StringMatch(regexp.MustCompile("^[A-Z]{2}$"), "MetroCode must consist of two capital letters")
	StringIsEmailAddress   = validation.StringMatch(regexp.MustCompile("^[^ @]+@[^ @]+$"), "not valid email address")
	StringIsPortDefinition = validation.StringMatch(
		regexp.MustCompile("^(([0-9]+(,[0-9]+){0,9})|([0-9]+-[0-9]+)|(any))$"),
		"port definition has to be: up to 10 comma sepparated numbers (22,23), range (20-23) or word 'any'")
	StringIsSpeedBand   = validation.StringMatch(regexp.MustCompile("^[0-9]+(MB|GB)$"), "SpeedBand should consist of digit followed by MB or GB")
	StringIsCountryCode = stringvalidator.RegexMatches(regexp.MustCompile("(?i)^[a-z]{2}$"), "Address country must be a two letter code (ISO 3166-1 alpha-2)")
)

Functions

func URLWithScheme added in v1.33.0

func URLWithScheme(schemes ...string) validator.String

URLWithScheme returns a string validator which ensures that any configured attribute value:

  • Is a string, which represents a well-formed URL with host and has a scheme that matches predefined schemes

Null (unconfigured) and unknown (known after apply) values are skipped.

func UUID added in v1.33.0

func UUID() validator.String

UUID returns a string validator which ensures that any configured attribute value:

  • Is a string, which represents valid UUID.

Null (unconfigured) and unknown (known after apply) values are skipped.

Types

This section is empty.

Jump to

Keyboard shortcuts

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