validate

package
v0.0.0-...-af6bcab Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package validate contains methods for validating inputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoesNotMatchReErr

func DoesNotMatchReErr(r *regexp.Regexp) error

DoesNotMatchReErr returns an error indicating that a value does not match a regex.

func MatchReWithLength

func MatchReWithLength(re *regexp.Regexp, minLen, maxLen int, value string) error

MatchReWithLength validates a value matches the given re and its length is within the specific range [minLen, maxLen].

For convenience, if minLen > 0 and value == "", returns "unspecified" as the error message (instead of referring to length limit in the error message).

func Regexp

func Regexp(re string) error

Regexp returns a non-nil error if re is not a valid regular expression.

func RegexpFragment

func RegexpFragment(re string) error

RegexpFragment returns a non-nil error if re is not a valid regular expression fragment that can be embedded in a regex template.

func SpecifiedWithRe

func SpecifiedWithRe(re *regexp.Regexp, value string) error

SpecifiedWithRe validates a value is non-empty and matches the given re.

func Unspecified

func Unspecified() error

Unspecified returns an error indicating that a value is unspecified.

Types

This section is empty.

Jump to

Keyboard shortcuts

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