validators

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package validators contains built-in validators for parent package "github.com/s3rj1k/validator"

Index

Constants

View Source
const (
	Email          string = "" /* 1208-byte string literal not displayed */
	Alpha          string = "^[a-zA-Z]+$"
	Alphanumeric   string = "^[a-zA-Z0-9]+$"
	Numeric        string = "^[0-9]+$"
	Integer        string = "^(?:[-+]?(?:0|[1-9][0-9]*))$"
	Float          string = "^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"
	Hexadecimal    string = "^[0-9a-fA-F]+$"
	Hexcolor       string = "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
	RGBcolor       string = "" /* 157-byte string literal not displayed */
	ASCII          string = "^[\x00-\x7F]+$"
	Base64         string = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$"
	PrintableASCII string = "^[\x20-\x7E]+$"

	Passwd             string = "^[a-zA-Z0-9\\.\\/]+$" // nolint: gosec
	UserGroupName      string = "^[a-z_][a-z0-9_-]*[$]?$"
	HasAlpha           string = "[a-zA-Z]+"
	HasNumber          string = "[0-9]+"
	UnixFilePermission string = "^0[1-7][0-7]{2,3}$"
	SetNameIndex       string = `\[[0-9]+\]$`
)

Basic regular expressions for validating strings nolint: lll

View Source
const (
	// DefaultExecTimeoutSec is a default timeout for Exec validator group.
	DefaultExecTimeoutSec = 60
)

Variables

View Source
var (
	// ErrBadNumType is an error for unsupported type provided to number validators
	ErrBadNumType = errors.New("unsupported type provided to number validator")

	// ErrBadSliceType is an error for unsupported type provided to slice validators
	ErrBadSliceType = errors.New("unsupported type provided to slice validator")

	// ErrNilValue is an error for encountering nil in validator
	ErrNilValue = errors.New("nil value must not be provided to validator")
)
View Source
var (
	// DefaultMinUserGID is a default value for MinUserGID, used then parsing of 'login.defs' fails.
	DefaultMinUserGID uint64 = 1000

	// DefaultMaxUserGID is a default value for MaxUserGID, used then parsing of 'login.defs' fails.
	DefaultMaxUserGID uint64 = 60000
)

nolint: gochecknoglobals

View Source
var (
	// DefaultMinUserUID is a default value for MinUserUID, used then parsing of 'login.defs' fails.
	DefaultMinUserUID uint64 = 1000

	// DefaultMaxUserUID is a default value for MaxUserUID, used then parsing of 'login.defs' fails.
	DefaultMaxUserUID uint64 = 60000
)

nolint: gochecknoglobals

View Source
var ExecExitCodeHasAnyError = func(v *ExecExitCodeHasAny) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' after execution command must exit with any of defined status codes", strings.Join(v.Command, " "))
}

ExecExitCodeHasAnyError is a function that defines default error message returned by ExecExitCodeHasAny validator. nolint: gochecknoglobals

View Source
var ExecExitCodeHasNoneOfError = func(v *ExecExitCodeHasNoneOf) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' after execution command must exit with none of defined status codes", strings.Join(v.Command, " "))
}

ExecExitCodeHasNoneOfError is a function that defines default error message returned by ExecExitCodeHasNoneOf validator. nolint: gochecknoglobals

View Source
var ExecExitCodeIsNotZeroError = func(v *ExecExitCodeIsNotZero) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' after execution command must exit with none-zero status code", strings.Join(v.Command, " "))
}

ExecExitCodeIsNotZeroError is a function that defines default error message returned by ExecExitCodeIsNotZero validator. nolint: gochecknoglobals

View Source
var ExecExitCodeIsZeroError = func(v *ExecExitCodeIsZero) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' after execution command must exit with zero status code", strings.Join(v.Command, " "))
}

ExecExitCodeIsZeroError is a function that defines default error message returned by ExecExitCodeIsZero validator. nolint: gochecknoglobals

View Source
var FuncValidatorError = func(v *FuncValidator) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' failed custom func validation", v.Field)
}

FuncValidatorError is a function that defines error message returned by FuncValidator validator. nolint: gochecknoglobals

View Source
var (
	// LoginDefsPath is a default path to 'login.defs' file.
	LoginDefsPath = "/etc/login.defs"
)

nolint: gochecknoglobals

View Source
var NumberInRangeError = func(v *NumberInRange) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	e := fmt.Sprintf("'%s' not in range(%s, %s)", NumFieldToString(v.Field), NumFieldToString(v.Min), NumFieldToString(v.Max))

	if v.CheckEqual {
		return fmt.Sprintf("%s (inclusive)", e)
	}

	return e
}

NumberInRangeError is a function that defines error message returned by NumberInRange validator. nolint: gochecknoglobals

View Source
var NumberIsGreaterError = func(v *NumberIsGreater) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	errt := "is not greater than"

	if v.CheckEqual {
		errt += " or equal to"
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' %s '%s'", NumFieldToString(v.Field), errt, NumFieldToString(v.ComparedField))
	}

	return fmt.Sprintf("'%s' %s '%s'", v.Name, errt, v.ComparedName)
}

NumberIsGreaterError is a function that defines error message returned by NumberIsGreater validator. nolint: gochecknoglobals

View Source
var NumberIsLessError = func(v *NumberIsLess) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	errt := "is not less than"

	if v.CheckEqual {
		errt += " or equal to"
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' %s '%s'", NumFieldToString(v.Field), errt, NumFieldToString(v.ComparedField))
	}

	return fmt.Sprintf("'%s' %s '%s'", v.Name, errt, v.ComparedName)
}

NumberIsLessError is a function that defines error message returned by NumberIsLess validator. nolint: gochecknoglobals

View Source
var NumberIsNotZeroError = func(v *NumberIsNotZero) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must not be equal to 0", v.Name)
}

NumberIsNotZeroError is a function that defines error message returned by NumberIsNotZero validator. nolint: gochecknoglobals

View Source
var NumberIsValidUserGIDError = func(v *NumberIsValidUserGID) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a valid user GID", NumFieldToString(v.Field))
}

NumberIsValidUserGIDError is a function that defines error message returned by NumberIsValidUserGID validator. nolint: gochecknoglobals

View Source
var NumberIsValidUserUIDError = func(v *NumberIsValidUserUID) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a valid user UID", NumFieldToString(v.Field))
}

NumberIsValidUserUIDError is a function that defines error message returned by NumberIsValidUserUID validator. nolint: gochecknoglobals

View Source
var NumbersAreEqualError = func(v *NumbersAreEqual) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' is not equal to '%s'", NumFieldToString(v.Field), NumFieldToString(v.ComparedField))
	}

	return fmt.Sprintf("'%s' is not equal to '%s'", v.Name, v.ComparedName)
}

NumbersAreEqualError is a function that defines error message returned by NumbersAreEqual validator. nolint: gochecknoglobals

View Source
var NumbersAreNotEqualError = func(v *NumbersAreNotEqual) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' is equal to '%s'", NumFieldToString(v.Field), NumFieldToString(v.ComparedField))
	}

	return fmt.Sprintf("'%s' is equal to '%s'", v.Name, v.ComparedName)
}

NumbersAreNotEqualError is a function that defines error message returned by NumbersAreNotEqual validator. nolint: gochecknoglobals

View Source
var SliceIsNotEmptyError = func(v *SliceIsNotEmpty) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' slice is empty", v.Name)
}

SliceIsNotEmptyError is a function that defines error message returned by SliceIsNotEmpty validator. nolint: gochecknoglobals

View Source
var SliceIsUniqueError = func(v *SliceIsUnique) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("%v values are not unique", v.Field)
}

SliceIsUniqueError is a function that defines error message returned by SliceIsUnique validator. nolint: gochecknoglobals

View Source
var SliceLengthInRangeError = func(v *SliceLengthInRange) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	min := v.Min
	max := v.Max

	if max == 0 {
		max = v.length
	}

	if max == -1 {
		return fmt.Sprintf("%v is not empty", v.Field)
	}

	return fmt.Sprintf("%v length=%d not in range(%d, %d)", v.Field, v.length, min, max)
}

SliceLengthInRangeError is a function that defines error message returned by SliceLengthInRange validator. nolint: gochecknoglobals

View Source
var StringContainsAnyError = func(v *StringContainsAny) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' does not contain any substrings from %v", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' does not contain any substrings from '%s'", v.Name, v.ComparedName)
}

StringContainsAnyError is a function that defines error message returned by StringContainsAny validator. nolint: gochecknoglobals

View Source
var StringContainsNoneOfError = func(v *StringContainsNoneOf) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' contains substring from %v", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' contains substring from '%s'", v.Name, v.ComparedName)
}

StringContainsNoneOfError is a function that defines error message returned by StringContainsNoneOf validator. nolint: gochecknoglobals

View Source
var StringExclusionError = func(v *StringExclusion) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("%s is in the blacklist %v", v.Name, v.Blacklist)
}

StringExclusionError is a function that defines error message returned by StringExclusion validator. nolint: gochecknoglobals

View Source
var StringHasAlphaError = func(v *StringHasAlpha) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' has no letters", v.Field)
}

StringHasAlphaError is a function that defines error message returned by StringHasAlpha validator. nolint: gochecknoglobals

View Source
var StringHasLowerCaseError = func(v *StringHasLowerCase) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain at least 1 lowercase", v.Field)
}

StringHasLowerCaseError is a function that defines error message returned by StringHasLowerCase validator. nolint: gochecknoglobals

View Source
var StringHasNoFileInPathParentsError = func(v *StringHasNoFileInPathParents) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("path '%s' contains path to a file", v.Field)
}

StringHasNoFileInPathParentsError is a function that defines error message returned by StringHasNoFileInPathParents validator. nolint: gochecknoglobals

View Source
var StringHasNoPrefixError = func(v *StringHasNoPrefix) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' starts with '%s'", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' starts with content of '%s'", v.Name, v.ComparedName)
}

StringHasNoPrefixError is a function that defines error message returned by StringHasNoPrefix validator. nolint: gochecknoglobals

View Source
var StringHasNoSuffixError = func(v *StringHasNoSuffix) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' ends with '%s'", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' ends with content of '%s'", v.Name, v.ComparedName)
}

StringHasNoSuffixError is a function that defines error message returned by StringHasNoSuffix validator. nolint: gochecknoglobals

View Source
var StringHasNoWhitespaceError = func(v *StringHasNoWhitespace) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' has whitespace", v.Field)
}

StringHasNoWhitespaceError is a function that defines error message returned by StringHasNoWhitespace validator. nolint: gochecknoglobals

View Source
var StringHasNumberError = func(v *StringHasNumber) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' has no numbers", v.Field)
}

StringHasNumberError is a function that defines error message returned by StringHasNumber validator. nolint: gochecknoglobals

View Source
var StringHasPrefixAnyError = func(v *StringHasPrefixAny) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' has no prefix from %v", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' has no prefix from contents of '%s'", v.Name, v.ComparedName)
}

StringHasPrefixAnyError is a function that defines error message returned by StringHasPrefixAny validator. nolint: gochecknoglobals

View Source
var StringHasPrefixError = func(v *StringHasPrefix) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' does not start with '%s'", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' does not start with content of '%s'", v.Name, v.ComparedName)

}

StringHasPrefixError is a function that defines error message returned by StringHasPrefix validator. nolint: gochecknoglobals

View Source
var StringHasPrefixNoneOfError = func(v *StringHasPrefixNoneOf) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' has prefix from %v", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' has prefix from contents of '%s'", v.Name, v.ComparedName)
}

StringHasPrefixNoneOfError is a function that defines error message returned by StringHasPrefixNoneOf validator. nolint: gochecknoglobals

View Source
var StringHasSuffixAnyError = func(v *StringHasSuffixAny) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' has no suffix from %v", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' has no suffix from contents of '%s'", v.Name, v.ComparedName)
}

StringHasSuffixAnyError is a function that defines error message returned by StringHasSuffixAny validator. nolint: gochecknoglobals

View Source
var StringHasSuffixError = func(v *StringHasSuffix) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' does not end with '%s'", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' does not end with content of '%s'", v.Name, v.ComparedName)

}

StringHasSuffixError is a function that defines error message returned by StringHasSuffix validator. nolint: gochecknoglobals

View Source
var StringHasSuffixNoneOfError = func(v *StringHasSuffixNoneOf) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' has suffix from %v", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' has suffix from contents of '%s'", v.Name, v.ComparedName)
}

StringHasSuffixNoneOfError is a function that defines error message returned by StringHasSuffixNoneOf validator. nolint: gochecknoglobals

View Source
var StringHasUpperCaseError = func(v *StringHasUpperCase) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain at least 1 uppercase", v.Field)
}

StringHasUpperCaseError is a function that defines error message returned by StringHasUpperCase validator. nolint: gochecknoglobals

View Source
var StringInclusionError = func(v *StringInclusion) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not in the whitelist %v", v.Field, v.Whitelist)
}

StringInclusionError is a function that defines error message returned by StringInclusion validator. nolint: gochecknoglobals

View Source
var StringIsASCIIError = func(v *StringIsASCII) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain ASCII chars only", v.Field)
}

StringIsASCIIError is a function that defines error message returned by StringIsASCII validator. nolint: gochecknoglobals

View Source
var StringIsAbsPathError = func(v *StringIsAbsPath) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("path '%s' must be absolute", v.Field)
}

StringIsAbsPathError is a function that defines error message returned by StringIsAbsPath validator. nolint: gochecknoglobals

View Source
var StringIsAlphaError = func(v *StringIsAlpha) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain only letters", v.Field)
}

StringIsAlphaError is a function that defines error message returned by StringIsAlpha validator. nolint: gochecknoglobals

View Source
var StringIsAlphaNumError = func(v *StringIsAlphaNum) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain only numbers and/or letters", v.Field)
}

StringIsAlphaNumError is a function that defines error message returned by StringIsAlphaNum validator. nolint: gochecknoglobals

View Source
var StringIsBase64Error = func(v *StringIsBase64) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be base64 encoded", v.Field)
}

StringIsBase64Error is a function that defines error message returned by StringIsBase64 validator. nolint: gochecknoglobals

View Source
var StringIsCIDRError = func(v *StringIsCIDR) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a CIDR notation address", v.Field)
}

StringIsCIDRError is a function that defines error message returned by StringIsCIDR validator. nolint: gochecknoglobals

View Source
var StringIsCIDRv4Error = func(v *StringIsCIDRv4) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be CIDR notation of IPv4 address", v.Field)
}

StringIsCIDRv4Error is a function that defines error message returned by StringIsCIDRv4 validator. nolint: gochecknoglobals

View Source
var StringIsCIDRv6Error = func(v *StringIsCIDRv6) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be CIDR notation of IPv6 address", v.Field)
}

StringIsCIDRv6Error is a function that defines error message returned by StringIsCIDRv6 validator. nolint: gochecknoglobals

View Source
var StringIsDirError = func(v *StringIsDir) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("path '%s' is not a dir", v.Field)
}

StringIsDirError is a function that defines error message returned by StringIsDir validator. nolint: gochecknoglobals

View Source
var StringIsDirWithModeStickyError = func(v *StringIsDirWithModeSticky) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a dir or a dir without sticky mode", v.Field)
}

StringIsDirWithModeStickyError is a function that defines error message returned by StringIsDirWithModeSticky validator. nolint: gochecknoglobals

View Source
var StringIsDirWithoutModeStickyError = func(v *StringIsDirWithoutModeSticky) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a dir or a dir with mode sticky", v.Field)
}

StringIsDirWithoutModeStickyError is a function that defines error message returned by StringIsDirWithoutModeSticky validator. nolint: gochecknoglobals

View Source
var StringIsEmailError = func(v *StringIsEmail) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' does not match an email format", v.Field)
}

StringIsEmailError is a function that defines error message returned by StringIsEmail validator. nolint: gochecknoglobals

View Source
var StringIsEmailLikeError = func(v *StringIsEmailLike) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("%s does not match an email-like format", v.Field)
}

StringIsEmailLikeError is a function that defines error message returned by StringIsEmailLike validator. nolint: gochecknoglobals

View Source
var StringIsExistingGroupError = func(v *StringIsExistingGroup) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' user group does not exist", v.Field)
}

StringIsExistingGroupError is a function that defines error message returned by StringIsExistingGroup validator. nolint: gochecknoglobals

View Source
var StringIsExistingUserError = func(v *StringIsExistingUser) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' user does not exist", v.Field)
}

StringIsExistingUserError is a function that defines error message returned by StringIsExistingUser validator. nolint: gochecknoglobals

View Source
var StringIsFileAndIsExecutableError = func(v *StringIsFileAndIsExecutable) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' does not have execute bit set", v.Field)
}

StringIsFileAndIsExecutableError is a function that defines error message returned by StringIsFileAndIsExecutable validator. nolint: gochecknoglobals

View Source
var StringIsFileAndIsNotExecutableError = func(v *StringIsFileAndIsNotExecutable) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' has execute bit set", v.Field)
}

StringIsFileAndIsNotExecutableError is a function that defines error message returned by StringIsFileAndIsNotExecutable validator. nolint: gochecknoglobals

View Source
var StringIsFileError = func(v *StringIsFile) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a file", v.Field)
}

StringIsFileError is a function that defines error message returned by StringIsFile validator. nolint: gochecknoglobals

View Source
var StringIsFloatError = func(v *StringIsFloat) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a float", v.Field)
}

StringIsFloatError is a function that defines error message returned by StringIsFloat validator. nolint: gochecknoglobals

View Source
var StringIsHTTPURLError = func(v *StringIsHTTPURL) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a valid URL", v.Field)
}

StringIsHTTPURLError is a function that defines error message returned by StringIsHTTPURL validator. nolint: gochecknoglobals

View Source
var StringIsHashError = func(v *StringIsHash) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a valid '%s' hash", v.Field, v.Algorithm)
}

StringIsHashError is a function that defines error message returned by StringIsHash validator. nolint: gochecknoglobals

View Source
var StringIsHexadecimalError = func(v *StringIsHexadecimal) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a hexadecimal number", v.Field)
}

StringIsHexadecimalError is a function that defines error message returned by StringIsHexadecimal validator. nolint: gochecknoglobals

View Source
var StringIsHexcolorError = func(v *StringIsHexcolor) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a hexadecimal color", v.Field)
}

StringIsHexcolorError is a function that defines error message returned by StringIsHexcolor validator. nolint: gochecknoglobals

View Source
var StringIsIPError = func(v *StringIsIP) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be either IP version 4 or 6", v.Field)
}

StringIsIPError is a function that defines error message returned by StringIsIP validator. nolint: gochecknoglobals

View Source
var StringIsIPGlobalUnicastError = func(v *StringIsIPGlobalUnicast) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be Global Unicast IP", v.Field)
}

StringIsIPGlobalUnicastError is a function that defines error message returned by StringIsIPGlobalUnicast validator. nolint: gochecknoglobals

View Source
var StringIsIPHasPTRError = func(v *StringIsIPHasPTR) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be an IP address with resolvable PTR record", v.Field)
}

StringIsIPHasPTRError is a function that defines error message returned by StringIsIPHasPTR validator. nolint: gochecknoglobals

View Source
var StringIsIPIfaceLocalMulticastError = func(v *StringIsIPIfaceLocalMulticast) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be an interface-local multicast address", v.Field)
}

StringIsIPIfaceLocalMulticastError is a function that defines error message returned by StringIsIPIfaceLocalMulticast validator. nolint: gochecknoglobals

View Source
var StringIsIPLinkLocalMulticastError = func(v *StringIsIPLinkLocalMulticast) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a link-local multicast address", v.Field)
}

StringIsIPLinkLocalMulticastError is a function that defines error message returned by StringIsIPLinkLocalMulticast validator. nolint: gochecknoglobals

View Source
var StringIsIPLinkLocalUnicastError = func(v *StringIsIPLinkLocalUnicast) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a link-local unicast address", v.Field)
}

StringIsIPLinkLocalUnicastError is a function that defines error message returned by StringIsIPLinkLocalUnicast validator. nolint: gochecknoglobals

View Source
var StringIsIPLoopbackError = func(v *StringIsIPLoopback) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a loopback address", v.Field)
}

StringIsIPLoopbackError is a function that defines error message returned by StringIsIPLoopback validator. nolint: gochecknoglobals

View Source
var StringIsIPMulticastError = func(v *StringIsIPMulticast) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a multicast address", v.Field)
}

StringIsIPMulticastError is a function that defines error message returned by StringIsIPMulticast validator. nolint: gochecknoglobals

View Source
var StringIsIPUnspecError = func(v *StringIsIPUnspec) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be an unspecified address either IPv4 '0.0.0.0' or the IPv6 '::'", v.Field)
}

StringIsIPUnspecError is a function that defines error message returned by StringIsIPUnspec validator. nolint: gochecknoglobals

View Source
var StringIsIPv4Error = func(v *StringIsIPv4) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be IPv4", v.Field)
}

StringIsIPv4Error is a function that defines error message returned by StringIsIPv4 validator. nolint: gochecknoglobals

View Source
var StringIsIPv6Error = func(v *StringIsIPv6) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be IPv6", v.Field)
}

StringIsIPv6Error is a function that defines error message returned by StringIsIPv6 validator. nolint: gochecknoglobals

View Source
var StringIsIntError = func(v *StringIsInt) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be an integer", v.Field)
}

StringIsIntError is a function that defines error message returned by StringIsInt validator. nolint: gochecknoglobals

View Source
var StringIsJSONError = func(v *StringIsJSON) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a valid JSON", v.Field)
}

StringIsJSONError is a function that defines error message returned by StringIsJSON validator. nolint: gochecknoglobals

View Source
var StringIsLowerCaseError = func(v *StringIsLowerCase) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be lowercased", v.Field)
}

StringIsLowerCaseError is a function that defines error message returned by StringIsLowerCase validator. nolint: gochecknoglobals

View Source
var StringIsMACError = func(v *StringIsMAC) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be valid MAC address", v.Field)
}

StringIsMACError is a function that defines error message returned by StringIsMAC validator. nolint: gochecknoglobals

View Source
var StringIsNotDirError = func(v *StringIsNotDir) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("path '%s' is a dir", v.Field)
}

StringIsNotDirError is a function that defines error message returned by StringIsNotDir validator. nolint: gochecknoglobals

View Source
var StringIsNotExistingGroupError = func(v *StringIsNotExistingGroup) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' user group exists", v.Field)
}

StringIsNotExistingGroupError is a function that defines error message returned by StringIsNotExistingGroup validator. nolint: gochecknoglobals

View Source
var StringIsNotExistingUserError = func(v *StringIsNotExistingUser) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' user exists", v.Field)
}

StringIsNotExistingUserError is a function that defines error message returned by StringIsNotExistingUser validator. nolint: gochecknoglobals

View Source
var StringIsNotFileError = func(v *StringIsNotFile) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is a file", v.Field)
}

StringIsNotFileError is a function that defines error message returned by StringIsNotFile validator. nolint: gochecknoglobals

View Source
var StringIsNotNumericError = func(v *StringIsNotNumeric) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is numeric", v.Field)
}

StringIsNotNumericError is a function that defines error message returned by StringIsNotNumeric validator. nolint: gochecknoglobals

View Source
var StringIsNotPathError = func(v *StringIsNotPath) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("path '%s' must not exist", v.Field)
}

StringIsNotPathError is a function that defines error message returned by StringIsNotPath validator. nolint: gochecknoglobals

View Source
var StringIsNotRegularUserError = func(v *StringIsNotRegularUser) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is a regular user", v.Field)
}

StringIsNotRegularUserError is a function that defines error message returned by StringIsNotRegularUser validator. nolint: gochecknoglobals

View Source
var StringIsNotResolvableHostnameError = func(v *StringIsNotResolvableHostname) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is a resolvable hostname", v.Field)
}

StringIsNotResolvableHostnameError is a function that defines error message returned by StringIsNotResolvableHostname validator. nolint: gochecknoglobals

View Source
var StringIsNotResolvableHostnameNorIPError = func(v *StringIsNotResolvableHostnameNorIP) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is a resolvable hostname or an IP address", v.Field)
}

StringIsNotResolvableHostnameNorIPError is a function that defines error message returned by StringIsNotResolvableHostnameNorIP validator. nolint: gochecknoglobals

View Source
var StringIsNotResolvableHostnameNorIPv4Error = func(v *StringIsNotResolvableHostnameNorIPv4) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is a resolvable hostname or an IPv4 address", v.Field)
}

StringIsNotResolvableHostnameNorIPv4Error is a function that defines error message returned by StringIsNotResolvableHostnameNorIPv4 validator. nolint: gochecknoglobals

View Source
var StringIsNotResolvableHostnameNorIPv6Error = func(v *StringIsNotResolvableHostnameNorIPv6) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is a resolvable hostname or an IPv6 address", v.Field)
}

StringIsNotResolvableHostnameNorIPv6Error is a function that defines error message returned by StringIsNotResolvableHostnameNorIPv6 validator. nolint: gochecknoglobals

View Source
var StringIsNotSymlinkError = func(v *StringIsNotSymlink) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("path '%s' is a symlink", v.Field)
}

StringIsNotSymlinkError is a function that defines error message returned by StringIsNotSymlink validator. nolint: gochecknoglobals

View Source
var StringIsNotUserGroupError = func(v *StringIsNotUserGroup) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is a user group", v.Field)
}

StringIsNotUserGroupError is a function that defines error message returned by StringIsNotUserGroup validator. nolint: gochecknoglobals

View Source
var StringIsNullError = func(v *StringIsNull) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be empty", v.Field)
}

StringIsNullError is a function that defines error message returned by StringIsNull validator. nolint: gochecknoglobals

View Source
var StringIsNumericError = func(v *StringIsNumeric) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain only numbers", v.Field)
}

StringIsNumericError is a function that defines error message returned by StringIsNumeric validator. nolint: gochecknoglobals

View Source
var StringIsPathAndCharDeviceError = func(v *StringIsPathAndCharDevice) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path without CharDevice mode", v.Field)
}

StringIsPathAndCharDeviceError is a function that defines error message returned by StringIsPathAndCharDevice validator. nolint: gochecknoglobals

View Source
var StringIsPathAndDeviceError = func(v *StringIsPathAndDevice) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path without Device mode", v.Field)
}

StringIsPathAndDeviceError is a function that defines error message returned by StringIsPathAndDevice validator. nolint: gochecknoglobals

View Source
var StringIsPathAndIrregularFileError = func(v *StringIsPathAndIrregularFile) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path without Irregular mode", v.Field)
}

StringIsPathAndIrregularFileError is a function that defines error message returned by StringIsPathAndIrregularFile validator. nolint: gochecknoglobals

View Source
var StringIsPathAndIsWritableError = func(v *StringIsPathAndIsWritable) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' path is not writable", v.Field)
}

StringIsPathAndIsWritableError is a function that defines error message returned by StringIsPathAndIsWritable validator. nolint: gochecknoglobals

View Source
var StringIsPathAndNamedPipeError = func(v *StringIsPathAndNamedPipe) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path without NamedPipe mode", v.Field)
}

StringIsPathAndNamedPipeError is a function that defines error message returned by StringIsPathAndNamedPipe validator. nolint: gochecknoglobals

View Source
var StringIsPathAndNotCharDeviceError = func(v *StringIsPathAndNotCharDevice) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path with CharDevice mode", v.Field)
}

StringIsPathAndNotCharDeviceError is a function that defines error message returned by StringIsPathAndNotCharDevice validator. nolint: gochecknoglobals

View Source
var StringIsPathAndNotDeviceError = func(v *StringIsPathAndNotDevice) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path with Device mode", v.Field)
}

StringIsPathAndNotDeviceError is a function that defines error message returned by StringIsPathAndNotDevice validator. nolint: gochecknoglobals

View Source
var StringIsPathAndNotNamedPipeError = func(v *StringIsPathAndNotNamedPipe) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path with NamedPipe mode", v.Field)
}

StringIsPathAndNotNamedPipeError is a function that defines error message returned by StringIsPathAndNotNamedPipe validator. nolint: gochecknoglobals

View Source
var StringIsPathAndNotSocketError = func(v *StringIsPathAndNotSocket) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path with Socket mode", v.Field)
}

StringIsPathAndNotSocketError is a function that defines error message returned by StringIsPathAndNotSocket validator. nolint: gochecknoglobals

View Source
var StringIsPathAndRegularFileError = func(v *StringIsPathAndRegularFile) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing non-regular file", v.Field)
}

StringIsPathAndRegularFileError is a function that defines error message returned by StringIsPathAndRegularFile validator. nolint: gochecknoglobals

View Source
var StringIsPathAndSocketError = func(v *StringIsPathAndSocket) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path without Socket mode", v.Field)
}

StringIsPathAndSocketError is a function that defines error message returned by StringIsPathAndSocket validator. nolint: gochecknoglobals

View Source
var StringIsPathError = func(v *StringIsPath) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("path '%s' must exist", v.Field)
}

StringIsPathError is a function that defines error message returned by StringIsPath validator. nolint: gochecknoglobals

View Source
var StringIsPathWithSetGIDError = func(v *StringIsPathWithSetGID) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path without SetGID flag", v.Field)
}

StringIsPathWithSetGIDError is a function that defines error message returned by StringIsPathWithSetGID validator. nolint: gochecknoglobals

View Source
var StringIsPathWithSetUIDError = func(v *StringIsPathWithSetUID) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path without SetUID flag", v.Field)
}

StringIsPathWithSetUIDError is a function that defines error message returned by StringIsPathWithSetUID validator. nolint: gochecknoglobals

View Source
var StringIsPathWithoutSetGIDError = func(v *StringIsPathWithoutSetGID) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path with SetGID flag", v.Field)
}

StringIsPathWithoutSetGIDError is a function that defines error message returned by StringIsPathWithoutSetGID validator. nolint: gochecknoglobals

View Source
var StringIsPathWithoutSetUIDError = func(v *StringIsPathWithoutSetUID) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not an existing path or is an existing path with SetGID flag", v.Field)
}

StringIsPathWithoutSetUIDError is a function that defines error message returned by StringIsPathWithoutSetUID validator. nolint: gochecknoglobals

View Source
var StringIsPortError = func(v *StringIsPort) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a valid port", v.Field)
}

StringIsPortError is a function that defines error message returned by StringIsPort validator. nolint: gochecknoglobals

View Source
var StringIsPresentError = func(v *StringIsPresent) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must not be blank", v.Name)
}

StringIsPresentError is a function that defines error message returned by StringIsPresent validator. nolint: gochecknoglobals

View Source
var StringIsPrintableASCIIError = func(v *StringIsPrintableASCII) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain printable ASCII chars only", v.Field)
}

StringIsPrintableASCIIError is a function that defines error message returned by StringIsPrintableASCII validator. nolint: gochecknoglobals

View Source
var StringIsRGBcolorError = func(v *StringIsRGBcolor) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must be a RGB color in format rgb(RRR, GGG, BBB)", v.Field)
}

StringIsRGBcolorError is a function that defines error message returned by StringIsRGBcolor validator. nolint: gochecknoglobals

View Source
var StringIsRegularUserOrWhitelistedError = func(v *StringIsRegularUserOrWhitelisted) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a regular user or whitelisted", v.Field)
}

StringIsRegularUserOrWhitelistedError is a function that defines error message returned by StringIsRegularUserOrWhitelisted validator. nolint: gochecknoglobals

View Source
var StringIsResolvableHostnameError = func(v *StringIsResolvableHostname) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a resolvable hostname", v.Field)
}

StringIsResolvableHostnameError is a function that defines error message returned by StringIsResolvableHostname validator. nolint: gochecknoglobals

View Source
var StringIsResolvableHostnameOrIPError = func(v *StringIsResolvableHostnameOrIP) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a resolvable hostname and not an IP address", v.Field)
}

StringIsResolvableHostnameOrIPError is a function that defines error message returned by StringIsResolvableHostnameOrIP validator. nolint: gochecknoglobals

View Source
var StringIsResolvableHostnameOrIPv4Error = func(v *StringIsResolvableHostnameOrIPv4) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a resolvable hostname and not an IPv4 address", v.Field)
}

StringIsResolvableHostnameOrIPv4Error is a function that defines error message returned by StringIsResolvableHostnameOrIPv4 validator. nolint: gochecknoglobals

View Source
var StringIsResolvableHostnameOrIPv6Error = func(v *StringIsResolvableHostnameOrIPv6) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a resolvable hostname and not an IPv6 address", v.Field)
}

StringIsResolvableHostnameOrIPv6Error is a function that defines error message returned by StringIsResolvableHostnameOrIPv6 validator. nolint: gochecknoglobals

View Source
var StringIsSymlinkAndTargetIsDirError = func(v *StringIsSymlinkAndTargetIsDir) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("symlink's '%s' target is not a directory", v.Field)
}

StringIsSymlinkAndTargetIsDirError is a function that defines error message returned by StringIsSymlinkAndTargetIsDir validator. nolint: gochecknoglobals

View Source
var StringIsSymlinkAndTargetIsNotDirError = func(v *StringIsSymlinkAndTargetIsNotDir) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("symlink's '%s' target is a directory", v.Field)
}

StringIsSymlinkAndTargetIsNotDirError is a function that defines error message returned by StringIsSymlinkAndTargetIsNotDir validator. nolint: gochecknoglobals

View Source
var StringIsSymlinkAndTargetIsNotPathError = func(v *StringIsSymlinkAndTargetIsNotPath) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("symlink's '%s' target is an existing path", v.Field)
}

StringIsSymlinkAndTargetIsNotPathError is a function that defines error message returned by StringIsSymlinkAndTargetIsNotPath validator. nolint: gochecknoglobals

View Source
var StringIsSymlinkAndTargetIsPathError = func(v *StringIsSymlinkAndTargetIsPath) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("symlink's '%s' target is not an existing path", v.Field)
}

StringIsSymlinkAndTargetIsPathError is a function that defines error message returned by StringIsSymlinkAndTargetIsPath validator. nolint: gochecknoglobals

View Source
var StringIsSymlinkError = func(v *StringIsSymlink) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("path '%s' is not a symlink", v.Field)
}

StringIsSymlinkError is a function that defines error message returned by StringIsSymlink validator. nolint: gochecknoglobals

View Source
var StringIsUTFLetterNumError = func(v *StringIsUTFLetterNum) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain only unicode letter/number characters", v.Field)
}

StringIsUTFLetterNumError is a function that defines error message returned by StringIsUTFLetterNum validator. nolint: gochecknoglobals

View Source
var StringIsUTFLettersError = func(v *StringIsUTFLetters) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain only unicode letter characters", v.Field)
}

StringIsUTFLettersError is a function that defines error message returned by StringIsUTFLetters validator. nolint: gochecknoglobals

View Source
var StringIsUTFNumericError = func(v *StringIsUTFNumeric) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must contain only unicode numbers", v.Field)
}

StringIsUTFNumericError is a function that defines error message returned by StringIsUTFNumeric validator. nolint: gochecknoglobals

View Source
var StringIsUnixFilePermissionError = func(v *StringIsUnixFilePermission) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a unix file permission", v.Field)
}

StringIsUnixFilePermissionError is a function that defines error message returned by StringIsUnixFilePermission validator. nolint: gochecknoglobals

View Source
var StringIsUpperCaseError = func(v *StringIsUpperCase) string {

	if len(v.Message) > 0 {
		return v.Message
	}
	return fmt.Sprintf("'%s' must be uppercased", v.Field)
}

StringIsUpperCaseError is a function that defines error message returned by StringIsUpperCase validator. nolint: gochecknoglobals

View Source
var StringIsUserGroupOrWhitelistedError = func(v *StringIsUserGroupOrWhitelisted) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a user group or whitelisted", v.Field)
}

StringIsUserGroupOrWhitelistedError is a function that defines error message returned by StringIsUserGroupOrWhitelisted validator. nolint: gochecknoglobals

View Source
var StringIsValidShadowPasswordError = func(v *StringIsValidShadowPassword) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a valid shadow password", v.Field)
}

StringIsValidShadowPasswordError is a function that defines error message returned by StringIsValidShadowPassword validator. nolint: gochecknoglobals

View Source
var StringIsValidUserOrGroupNameError = func(v *StringIsValidUserOrGroupName) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' is not a valid user or group name", v.Field)
}

StringIsValidUserOrGroupNameError is a function that defines error message returned by StringIsValidUserOrGroupName validator. nolint: gochecknoglobals

View Source
var StringLengthInRangeError = func(v *StringLengthInRange) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	min := v.Min
	max := v.Max

	strLength := utf8.RuneCountInString(v.Field)
	if max == 0 {
		max = strLength
	}

	return fmt.Sprintf("'%s' not in range(%d, %d)", v.Field, min, max)
}

StringLengthInRangeError is a function that defines error message returned by StringLengthInRange validator. nolint: gochecknoglobals

View Source
var StringMatchRegexError = func(v *StringMatchRegex) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' does not match regex '%s'", v.Field, v.Regex)
}

StringMatchRegexError is a function that defines error message returned by StringMatchRegex validator. nolint: gochecknoglobals

View Source
var StringsAreEqualError = func(v *StringsAreEqual) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	var caseName string

	if v.CaseInsensitive {
		caseName = "iequal"

	} else {
		caseName = "equal"
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' does not %s '%s'", v.Field, caseName, v.ComparedField)
	}

	return fmt.Sprintf("'%s' does not %s '%s'", v.Name, caseName, v.ComparedName)
}

StringsAreEqualError is a function that defines error message returned by StringsAreEqual validator. nolint: gochecknoglobals

View Source
var StringsAreNotEqualError = func(v *StringsAreNotEqual) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	var caseName string

	if v.CaseInsensitive {
		caseName = "iequal"

	} else {
		caseName = "equal"
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' is %s to '%s'", v.Field, caseName, v.ComparedField)
	}

	return fmt.Sprintf("'%s' is %s to '%s'", v.Name, caseName, v.ComparedName)
}

StringsAreNotEqualError is a function that defines error message returned by StringsAreNotEqual validator. nolint: gochecknoglobals

View Source
var StringsArePathsInTheSameDirError = func(v *StringsArePathsInTheSameDir) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' path is not in the same dir with '%s'", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' path is not in the same dir with '%s'", v.Name, v.ComparedName)
}

StringsArePathsInTheSameDirError is a function that defines error message returned by StringsArePathsInTheSameDir validator. nolint: gochecknoglobals

View Source
var StringsArePathsNotInTheSameDirError = func(v *StringsArePathsNotInTheSameDir) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' path is in the same dir with '%s'", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' path is in the same dir with '%s'", v.Name, v.ComparedName)
}

StringsArePathsNotInTheSameDirError is a function that defines error message returned by StringsArePathsNotInTheSameDir validator. nolint: gochecknoglobals

View Source
var TimeIsAfterTimeError = func(v *TimeIsAfterTime) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s' must be after '%s'", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s' must be after '%s'", v.Name, v.ComparedName)
}

TimeIsAfterTimeError is a function that defines error message returned by TimeIsAfterTime validator. nolint: gochecknoglobals

View Source
var TimeIsBeforeTimeError = func(v *TimeIsBeforeTime) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	if len(v.ComparedName) == 0 {
		return fmt.Sprintf("'%s'  must be before '%s'", v.Field, v.ComparedField)
	}

	return fmt.Sprintf("'%s'  must be before '%s'", v.Name, v.ComparedName)
}

TimeIsBeforeTimeError is a function that defines error message returned by TimeIsBeforeTime validator. nolint: gochecknoglobals

View Source
var TimeIsPresentError = func(v *TimeIsPresent) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must not be blank", v.Name)
}

TimeIsPresentError is a function that defines error message returned by TimeIsPresent validator. nolint: gochecknoglobals

View Source
var UUIDIsPresentError = func(v *UUIDIsPresent) string {

	if len(v.Message) > 0 {
		return v.Message
	}

	return fmt.Sprintf("'%s' must not be blank", v.Name)
}

UUIDIsPresentError is a function that defines error message returned by UUIDIsPresent validator. nolint: gochecknoglobals

Functions

func Exists

func Exists(path string) bool

Exists returns true if path exists

func IsGroupIsUserGroupOrWhitelisted

func IsGroupIsUserGroupOrWhitelisted(name string, whitelist ...string) bool

IsGroupIsUserGroupOrWhitelisted checkes if name is an allowed name of group

func IsUserIsRegularUserOrWhitelisted

func IsUserIsRegularUserOrWhitelisted(name string, whitelist ...string) bool

IsUserIsRegularUserOrWhitelisted checkes if user is regular (non-system or unclassified) user.

func NumFieldToString

func NumFieldToString(field interface{}) string

NumFieldToString returns string representation of number field

func ReadUserGIDRange

func ReadUserGIDRange(path string) (uint64, uint64)

ReadUserGIDRange parses 'login.defs' file.

func ReadUserUIDRange

func ReadUserUIDRange(path string) (uint64, uint64)

ReadUserUIDRange parses 'login.defs' file.

Types

type ExecExitCodeHasAny

type ExecExitCodeHasAny struct {
	Name           string
	Command        []string
	Message        string
	ExitCodes      []int
	TimeoutSeconds int64
}

ExecExitCodeHasAny is a validator object. Validate adds an error if the Command value after execution returns with non of defined status codes.

func (*ExecExitCodeHasAny) Validate

func (v *ExecExitCodeHasAny) Validate(e *validator.Errors)

Validate adds an error if the Command value after execution returns with non of defined status codes.

type ExecExitCodeHasNoneOf

type ExecExitCodeHasNoneOf struct {
	Name           string
	Command        []string
	Message        string
	ExitCodes      []int
	TimeoutSeconds int64
}

ExecExitCodeHasNoneOf is a validator object. Validate adds an error if the Command value after execution returns with any of defined status codes.

func (*ExecExitCodeHasNoneOf) Validate

func (v *ExecExitCodeHasNoneOf) Validate(e *validator.Errors)

Validate adds an error if the Command value after execution returns with any of defined status codes.

type ExecExitCodeIsNotZero

type ExecExitCodeIsNotZero struct {
	Name           string
	Command        []string
	Message        string
	TimeoutSeconds int64
}

ExecExitCodeIsNotZero is a validator object. Validate adds an error if the Command value after execution returns zero exit code.

func (*ExecExitCodeIsNotZero) Validate

func (v *ExecExitCodeIsNotZero) Validate(e *validator.Errors)

Validate adds an error if the Command value after execution returns zero exit code.

type ExecExitCodeIsZero

type ExecExitCodeIsZero struct {
	Name           string
	Command        []string
	Message        string
	TimeoutSeconds int64
}

ExecExitCodeIsZero is a validator object. Validate adds an error if the Command value after execution returns non-zero exit code.

func (*ExecExitCodeIsZero) Validate

func (v *ExecExitCodeIsZero) Validate(e *validator.Errors)

Validate adds an error if the Command value after execution returns non-zero exit code.

type FuncValidator

type FuncValidator struct {
	Fn      func(interface{}) bool
	Name    string
	Field   interface{}
	Message string
}

FuncValidator is a validator object.

func (*FuncValidator) Validate

func (v *FuncValidator) Validate(e *validator.Errors)

Validate is a validation method wrapper.

type Number

type Number struct {
	Value uint64
	// contains filtered or unexported fields
}

Number represents a casted integer

func (*Number) IsEqual

func (x *Number) IsEqual(y *Number) bool

IsEqual returns true if x == y

func (*Number) IsGreater

func (x *Number) IsGreater(y *Number) bool

IsGreater returns true if x > y

func (*Number) IsLess

func (x *Number) IsLess(y *Number) bool

IsLess returns true if x < y

type NumberInRange

type NumberInRange struct {
	Name       string
	Field      interface{}
	Min        interface{}
	Max        interface{}
	CheckEqual bool
	Message    string
}

NumberInRange is a validator object. Validate adds an error if the Field is not in range between Min and Max (inclusive). Empty Min/Max values will be treated as 0 (zeros).

func (*NumberInRange) GetName

func (v *NumberInRange) GetName() string

GetName is a getter on Name field.

func (*NumberInRange) SetField

func (v *NumberInRange) SetField(s interface{})

SetField sets validator field.

func (*NumberInRange) SetNameIndex

func (v *NumberInRange) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*NumberInRange) Validate

func (v *NumberInRange) Validate(e *validator.Errors)

Validate adds an error if the Field is not in range between Min and Max (inclusive). Empty Min/Max values will be treated as 0 (zeros).

type NumberIsGreater

type NumberIsGreater struct {
	Name          string
	Field         interface{}
	ComparedName  string
	ComparedField interface{}
	CheckEqual    bool
	Message       string
}

NumberIsGreater is a validator object. Validate adds an error if the Field is not greater than the ComparedField.

func (*NumberIsGreater) GetName

func (v *NumberIsGreater) GetName() string

GetName is a getter on Name field.

func (*NumberIsGreater) SetField

func (v *NumberIsGreater) SetField(s interface{})

SetField sets validator field.

func (*NumberIsGreater) SetNameIndex

func (v *NumberIsGreater) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*NumberIsGreater) Validate

func (v *NumberIsGreater) Validate(e *validator.Errors)

Validate adds an error if the Field is not greater than the ComparedField.

type NumberIsLess

type NumberIsLess struct {
	Name          string
	Field         interface{}
	ComparedName  string
	ComparedField interface{}
	CheckEqual    bool
	Message       string
}

NumberIsLess is a validator object. Validate adds an error if the Field is not less than the ComparedField.

func (*NumberIsLess) GetName

func (v *NumberIsLess) GetName() string

GetName is a getter on Name field.

func (*NumberIsLess) SetField

func (v *NumberIsLess) SetField(s interface{})

SetField sets validator field.

func (*NumberIsLess) SetNameIndex

func (v *NumberIsLess) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*NumberIsLess) Validate

func (v *NumberIsLess) Validate(e *validator.Errors)

Validate adds an error if the Field is not less than the ComparedField.

type NumberIsNotZero

type NumberIsNotZero struct {
	Name    string
	Field   interface{}
	Message string
}

NumberIsNotZero is a validator object. Validate adds an error if the Field equals to 0.

func (*NumberIsNotZero) GetName

func (v *NumberIsNotZero) GetName() string

GetName is a getter on Name field.

func (*NumberIsNotZero) SetField

func (v *NumberIsNotZero) SetField(s interface{})

SetField sets validator field.

func (*NumberIsNotZero) SetNameIndex

func (v *NumberIsNotZero) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*NumberIsNotZero) Validate

func (v *NumberIsNotZero) Validate(e *validator.Errors)

Validate adds an error if the Field equals to 0.

type NumberIsValidUserGID

type NumberIsValidUserGID struct {
	Name    string
	Field   interface{}
	Message string
}

NumberIsValidUserGID is a validator object. Validate adds an error if the Field is in range of GID_MIN, GID_MAX from '/etc/login.defs'.

func (*NumberIsValidUserGID) GetName

func (v *NumberIsValidUserGID) GetName() string

GetName is a getter on Name field.

func (*NumberIsValidUserGID) SetField

func (v *NumberIsValidUserGID) SetField(s interface{})

SetField sets validator field.

func (*NumberIsValidUserGID) SetNameIndex

func (v *NumberIsValidUserGID) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*NumberIsValidUserGID) Validate

func (v *NumberIsValidUserGID) Validate(e *validator.Errors)

Validate adds an error if the Field is in range of GID_MIN, GID_MAX from '/etc/login.defs'.

type NumberIsValidUserUID

type NumberIsValidUserUID struct {
	Name    string
	Field   interface{}
	Message string
}

NumberIsValidUserUID is a validator object. Validate adds an error if the Field is in range of UID_MIN, UID_MAX from '/etc/login.defs'.

func (*NumberIsValidUserUID) GetName

func (v *NumberIsValidUserUID) GetName() string

GetName is a getter on Name field.

func (*NumberIsValidUserUID) SetField

func (v *NumberIsValidUserUID) SetField(s interface{})

SetField sets validator field.

func (*NumberIsValidUserUID) SetNameIndex

func (v *NumberIsValidUserUID) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*NumberIsValidUserUID) Validate

func (v *NumberIsValidUserUID) Validate(e *validator.Errors)

Validate adds an error if the Field is in range of UID_MIN, UID_MAX from '/etc/login.defs'.

type NumberSliceDive

type NumberSliceDive struct {
	Validator NumberValidator
	Field     interface{}
}

NumberSliceDive is a validator object. Validate applies Validator to each value in the Field.

func (*NumberSliceDive) Validate

func (v *NumberSliceDive) Validate(e *validator.Errors)

Validate applies Validator to each value in the Field.

type NumberValidator

type NumberValidator interface {
	Validate(*validator.Errors)
	SetField(interface{})
	SetNameIndex(int)
	GetName() string
}

NumberValidator is an interface for string validator objects.

type NumbersAreEqual

type NumbersAreEqual struct {
	Name          string
	Field         interface{}
	ComparedName  string
	ComparedField interface{}
	Message       string
}

NumbersAreEqual is a validator object. Validate adds an error if the Field is not equal to the ComparedField.

func (*NumbersAreEqual) GetName

func (v *NumbersAreEqual) GetName() string

GetName is a getter on Name field.

func (*NumbersAreEqual) SetField

func (v *NumbersAreEqual) SetField(s interface{})

SetField sets validator field.

func (*NumbersAreEqual) SetNameIndex

func (v *NumbersAreEqual) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*NumbersAreEqual) Validate

func (v *NumbersAreEqual) Validate(e *validator.Errors)

Validate adds an error if the Field is not equal to the ComparedField.

type NumbersAreNotEqual

type NumbersAreNotEqual struct {
	Name          string
	Field         interface{}
	ComparedName  string
	ComparedField interface{}
	Message       string
}

NumbersAreNotEqual is a validator object. Validate adds an error if the Field is equal to the ComparedField.

func (*NumbersAreNotEqual) GetName

func (v *NumbersAreNotEqual) GetName() string

GetName is a getter on Name field.

func (*NumbersAreNotEqual) SetField

func (v *NumbersAreNotEqual) SetField(s interface{})

SetField sets validator field.

func (*NumbersAreNotEqual) SetNameIndex

func (v *NumbersAreNotEqual) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*NumbersAreNotEqual) Validate

func (v *NumbersAreNotEqual) Validate(e *validator.Errors)

Validate adds an error if the Field is equal to the ComparedField.

type SliceIsNotEmpty

type SliceIsNotEmpty struct {
	Name    string
	Field   interface{}
	Message string
}

SliceIsNotEmpty is a validator object. Validate adds an error if the slice in Field is empty. Standard check adds an error if the slice is nil or of unsupported type. Supports all Go basic types except for bool.

func (*SliceIsNotEmpty) Validate

func (v *SliceIsNotEmpty) Validate(e *validator.Errors)

Validate adds an error if the slice in Field is empty. Standard check adds an error if the slice is nil or of unsupported type. Supports all Go basic types except for bool. nolint: gocyclo

type SliceIsUnique

type SliceIsUnique struct {
	Name    string
	Field   interface{}
	Message string
}

SliceIsUnique is a validator object. Validate adds an error if the slice in Field has not unique values. Supports all Go basic types except for bool.

func (*SliceIsUnique) Validate

func (v *SliceIsUnique) Validate(e *validator.Errors)

Validate adds an error if the slice in Field has not unique values. Supports all Go basic types except for bool. nolint: gocyclo

type SliceLengthInRange

type SliceLengthInRange struct {
	Name    string
	Field   interface{}
	Min     int
	Max     int
	Message string
	// contains filtered or unexported fields
}

SliceLengthInRange is a validator object. Validate adds an error if the slice in Field is not in range between Min and Max (inclusive). User can provide either both or only Min/Max fields. If only Min provided - Max=length of slice. If only Max provided - Min=0. Max=-1 -> slice must be empty. Standard check adds an error if the slice is nil or of unsupported type.

func (*SliceLengthInRange) Validate

func (v *SliceLengthInRange) Validate(e *validator.Errors)

Validate adds an error if the slice in Field is not in range between Min and Max (inclusive). User can provide either both or only Min/Max fields. If only Min provided - Max=length of slice. If only Max provided - Min=0. Max=-1 -> slice must be empty. Standard check adds an error if the slice is nil or of unsupported type. nolint: gocyclo

type StringContainsAny

type StringContainsAny struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField []string
	Message       string
}

StringContainsAny is a validator object. Validate adds an error if the Field does not contain at least one substrings from ComparedField.

func (*StringContainsAny) SetField

func (v *StringContainsAny) SetField(s string)

SetField sets validator field.

func (*StringContainsAny) SetNameIndex

func (v *StringContainsAny) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringContainsAny) Validate

func (v *StringContainsAny) Validate(e *validator.Errors)

Validate adds an error if the Field does not contain at least one substrings from ComparedField.

type StringContainsNoneOf

type StringContainsNoneOf struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField []string
	Message       string
}

StringContainsNoneOf is a validator object. Validate adds an error if the Field contains at least one substrings from ComparedField.

func (*StringContainsNoneOf) SetField

func (v *StringContainsNoneOf) SetField(s string)

SetField sets validator field.

func (*StringContainsNoneOf) SetNameIndex

func (v *StringContainsNoneOf) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringContainsNoneOf) Validate

func (v *StringContainsNoneOf) Validate(e *validator.Errors)

Validate adds an error if the Field contains at least one substrings from ComparedField.

type StringExclusion

type StringExclusion struct {
	Name      string
	Field     string
	Blacklist []string
	Message   string
}

StringExclusion is a validator object. Validate adds an error if the Field is one of the values from the Blacklist.

func (*StringExclusion) SetField

func (v *StringExclusion) SetField(s string)

SetField sets validator field.

func (*StringExclusion) SetNameIndex

func (v *StringExclusion) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringExclusion) Validate

func (v *StringExclusion) Validate(e *validator.Errors)

Validate adds an error if the Field is one of the values from the Blacklist.

type StringHasAlpha

type StringHasAlpha struct {
	Name    string
	Field   string
	Message string
}

StringHasAlpha is a validator object. Validate adds an error if the Field has no letters.

func (*StringHasAlpha) SetField

func (v *StringHasAlpha) SetField(s string)

SetField sets validator field.

func (*StringHasAlpha) SetNameIndex

func (v *StringHasAlpha) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasAlpha) Validate

func (v *StringHasAlpha) Validate(e *validator.Errors)

Validate adds an error if the Field has no letters.

type StringHasLowerCase

type StringHasLowerCase struct {
	Name    string
	Field   string
	Message string
}

StringHasLowerCase is a validator object. Validate adds an error if the Field has not lowercased letters. Empty string is valid.

func (*StringHasLowerCase) SetField

func (v *StringHasLowerCase) SetField(s string)

SetField sets validator field.

func (*StringHasLowerCase) SetNameIndex

func (v *StringHasLowerCase) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasLowerCase) Validate

func (v *StringHasLowerCase) Validate(e *validator.Errors)

Validate adds an error if the Field has not lowercased letters. Empty string is valid.

type StringHasNoFileInPathParents

type StringHasNoFileInPathParents struct {
	Name    string
	Field   string
	Message string
}

StringHasNoFileInPathParents is a validator object. Validate adds an error if the Field contains path to a file.

func (*StringHasNoFileInPathParents) SetField

func (v *StringHasNoFileInPathParents) SetField(s string)

SetField sets validator field.

func (*StringHasNoFileInPathParents) SetNameIndex

func (v *StringHasNoFileInPathParents) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasNoFileInPathParents) Validate

Validate adds an error if the Field contains path to a file.

type StringHasNoPrefix

type StringHasNoPrefix struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField string
	Message       string
}

StringHasNoPrefix is a validator object. Validate adds an error if the Field is prefixed with ComparedField.

func (*StringHasNoPrefix) SetField

func (v *StringHasNoPrefix) SetField(s string)

SetField sets validator field.

func (*StringHasNoPrefix) SetNameIndex

func (v *StringHasNoPrefix) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasNoPrefix) Validate

func (v *StringHasNoPrefix) Validate(e *validator.Errors)

Validate adds an error if the Field is prefixed with ComparedField.

type StringHasNoSuffix

type StringHasNoSuffix struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField string
	Message       string
}

StringHasNoSuffix is a validator object. Validate adds an error if the Field is suffixed with ComparedField.

func (*StringHasNoSuffix) SetField

func (v *StringHasNoSuffix) SetField(s string)

SetField sets validator field.

func (*StringHasNoSuffix) SetNameIndex

func (v *StringHasNoSuffix) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasNoSuffix) Validate

func (v *StringHasNoSuffix) Validate(e *validator.Errors)

Validate adds an error if the Field is suffixed with ComparedField.

type StringHasNoWhitespace

type StringHasNoWhitespace struct {
	Name    string
	Field   string
	Message string
}

StringHasNoWhitespace is a validator object. Validate adds an error if the Field has whitespace.

func (*StringHasNoWhitespace) SetField

func (v *StringHasNoWhitespace) SetField(s string)

SetField sets validator field.

func (*StringHasNoWhitespace) SetNameIndex

func (v *StringHasNoWhitespace) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasNoWhitespace) Validate

func (v *StringHasNoWhitespace) Validate(e *validator.Errors)

Validate adds an error if the Field has whitespace.

type StringHasNumber

type StringHasNumber struct {
	Name    string
	Field   string
	Message string
}

StringHasNumber is a validator object. Validate adds an error if the Field has no numbers.

func (*StringHasNumber) SetField

func (v *StringHasNumber) SetField(s string)

SetField sets validator field.

func (*StringHasNumber) SetNameIndex

func (v *StringHasNumber) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasNumber) Validate

func (v *StringHasNumber) Validate(e *validator.Errors)

Validate adds an error if the Field has no numbers.

type StringHasPrefix

type StringHasPrefix struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField string
	Message       string
}

StringHasPrefix is a validator object. Validate adds an error if the Field is not prefixed with ComparedField.

func (*StringHasPrefix) SetField

func (v *StringHasPrefix) SetField(s string)

SetField sets validator field.

func (*StringHasPrefix) SetNameIndex

func (v *StringHasPrefix) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasPrefix) Validate

func (v *StringHasPrefix) Validate(e *validator.Errors)

Validate adds an error if the Field is not prefixed with ComparedField.

type StringHasPrefixAny

type StringHasPrefixAny struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField []string
	Message       string
}

StringHasPrefixAny is a validator object. Validate adds an error if the Field is not prefixed by at least one string from ComparedField.

func (*StringHasPrefixAny) SetField

func (v *StringHasPrefixAny) SetField(s string)

SetField sets validator field.

func (*StringHasPrefixAny) SetNameIndex

func (v *StringHasPrefixAny) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasPrefixAny) Validate

func (v *StringHasPrefixAny) Validate(e *validator.Errors)

Validate adds an error if the Field is not prefixed by at least one string from ComparedField.

type StringHasPrefixNoneOf

type StringHasPrefixNoneOf struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField []string
	Message       string
}

StringHasPrefixNoneOf is a validator object. Validate adds an error if the Field is prefixed by at least one string from ComparedField.

func (*StringHasPrefixNoneOf) SetField

func (v *StringHasPrefixNoneOf) SetField(s string)

SetField sets validator field.

func (*StringHasPrefixNoneOf) SetNameIndex

func (v *StringHasPrefixNoneOf) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasPrefixNoneOf) Validate

func (v *StringHasPrefixNoneOf) Validate(e *validator.Errors)

Validate adds an error if the Field is prefixed by at least one string from ComparedField.

type StringHasSuffix

type StringHasSuffix struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField string
	Message       string
}

StringHasSuffix is a validator object. Validate adds an error if the Field is not suffixed with ComparedField.

func (*StringHasSuffix) SetField

func (v *StringHasSuffix) SetField(s string)

SetField sets validator field.

func (*StringHasSuffix) SetNameIndex

func (v *StringHasSuffix) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasSuffix) Validate

func (v *StringHasSuffix) Validate(e *validator.Errors)

Validate adds an error if the Field is not suffixed with ComparedField.

type StringHasSuffixAny

type StringHasSuffixAny struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField []string
	Message       string
}

StringHasSuffixAny is a validator object. Validate adds an error if the Field is not Suffixed by at least one string from ComparedField.

func (*StringHasSuffixAny) SetField

func (v *StringHasSuffixAny) SetField(s string)

SetField sets validator field.

func (*StringHasSuffixAny) SetNameIndex

func (v *StringHasSuffixAny) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasSuffixAny) Validate

func (v *StringHasSuffixAny) Validate(e *validator.Errors)

Validate adds an error if the Field is not Suffixed by at least one string from ComparedField.

type StringHasSuffixNoneOf

type StringHasSuffixNoneOf struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField []string
	Message       string
}

StringHasSuffixNoneOf is a validator object. Validate adds an error if the Field is Suffixed by at least one string from ComparedField.

func (*StringHasSuffixNoneOf) SetField

func (v *StringHasSuffixNoneOf) SetField(s string)

SetField sets validator field.

func (*StringHasSuffixNoneOf) SetNameIndex

func (v *StringHasSuffixNoneOf) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasSuffixNoneOf) Validate

func (v *StringHasSuffixNoneOf) Validate(e *validator.Errors)

Validate adds an error if the Field is Suffixed by at least one string from ComparedField.

type StringHasUpperCase

type StringHasUpperCase struct {
	Name    string
	Field   string
	Message string
}

StringHasUpperCase is a validator object. Validate adds an error if the Field has not uppercased letters. Empty string is valid.

func (*StringHasUpperCase) SetField

func (v *StringHasUpperCase) SetField(s string)

SetField sets validator field.

func (*StringHasUpperCase) SetNameIndex

func (v *StringHasUpperCase) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringHasUpperCase) Validate

func (v *StringHasUpperCase) Validate(e *validator.Errors)

Validate adds an error if the Field has not uppercased letters. Empty string is valid.

type StringInclusion

type StringInclusion struct {
	Name      string
	Field     string
	Whitelist []string
	Message   string
}

StringInclusion is a validator object. Validate adds an error if the Field is NOT one of the values from the Whitelist.

func (*StringInclusion) SetField

func (v *StringInclusion) SetField(s string)

SetField sets validator field.

func (*StringInclusion) SetNameIndex

func (v *StringInclusion) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringInclusion) Validate

func (v *StringInclusion) Validate(e *validator.Errors)

Validate adds an error if the Field is NOT one of the values from the Whitelist.

type StringIsASCII

type StringIsASCII struct {
	Name    string
	Field   string
	Message string
}

StringIsASCII is a validator object. Validate adds an error if the Field contains anything except for ASCII characters. Empty string is valid.

func (*StringIsASCII) SetField

func (v *StringIsASCII) SetField(s string)

SetField sets validator field.

func (*StringIsASCII) SetNameIndex

func (v *StringIsASCII) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsASCII) Validate

func (v *StringIsASCII) Validate(e *validator.Errors)

Validate adds an error if the Field contains anything except for ASCII characters. Empty string is valid.

type StringIsAbsPath

type StringIsAbsPath struct {
	Name    string
	Field   string
	Message string
}

StringIsAbsPath is a validator object. Validate adds an error if Field is not an absolute path.

func (*StringIsAbsPath) SetField

func (v *StringIsAbsPath) SetField(s string)

SetField sets validator field.

func (*StringIsAbsPath) SetNameIndex

func (v *StringIsAbsPath) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsAbsPath) Validate

func (v *StringIsAbsPath) Validate(e *validator.Errors)

Validate adds an error if Field is not an absolute path.

type StringIsAlpha

type StringIsAlpha struct {
	Name    string
	Field   string
	Message string
}

StringIsAlpha is a validator object. Validate adds an error if the Field contains anything except for latin letters. Empty string is valid.

func (*StringIsAlpha) SetField

func (v *StringIsAlpha) SetField(s string)

SetField sets validator field.

func (*StringIsAlpha) SetNameIndex

func (v *StringIsAlpha) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsAlpha) Validate

func (v *StringIsAlpha) Validate(e *validator.Errors)

Validate adds an error if the Field contains anything except for latin letters. Empty string is valid.

type StringIsAlphaNum

type StringIsAlphaNum struct {
	Name    string
	Field   string
	Message string
}

StringIsAlphaNum is a validator object. Validate adds an error if the Field contains any symbols except for arabic numerals and latin letters. Empty string is valid.

func (*StringIsAlphaNum) SetField

func (v *StringIsAlphaNum) SetField(s string)

SetField sets validator field.

func (*StringIsAlphaNum) SetNameIndex

func (v *StringIsAlphaNum) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsAlphaNum) Validate

func (v *StringIsAlphaNum) Validate(e *validator.Errors)

Validate adds an error if the Field contains any symbols except for arabic numerals and latin letters. Empty string is valid.

type StringIsBase64

type StringIsBase64 struct {
	Name    string
	Field   string
	Message string
}

StringIsBase64 is a validator object. Validate adds an error if the Field is not base64 encoded. Empty string is valid.

func (*StringIsBase64) SetField

func (v *StringIsBase64) SetField(s string)

SetField sets validator field.

func (*StringIsBase64) SetNameIndex

func (v *StringIsBase64) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsBase64) Validate

func (v *StringIsBase64) Validate(e *validator.Errors)

Validate adds an error if the Field is not base64 encoded. Empty string is valid.

type StringIsCIDR

type StringIsCIDR struct {
	Name    string
	Field   string
	Message string
}

StringIsCIDR is a validator object. Validate adds an error if the Field is not a valid CIDR notation address.

func (*StringIsCIDR) SetField

func (v *StringIsCIDR) SetField(s string)

SetField sets validator field.

func (*StringIsCIDR) SetNameIndex

func (v *StringIsCIDR) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsCIDR) Validate

func (v *StringIsCIDR) Validate(e *validator.Errors)

Validate adds an error if the Field is not a valid CIDR notation address.

type StringIsCIDRv4

type StringIsCIDRv4 struct {
	Name    string
	Field   string
	Message string
}

StringIsCIDRv4 is a validator object. Validate adds an error if the Field is not a valid CIDR notation of IPv4 address.

func (*StringIsCIDRv4) SetField

func (v *StringIsCIDRv4) SetField(s string)

SetField sets validator field.

func (*StringIsCIDRv4) SetNameIndex

func (v *StringIsCIDRv4) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsCIDRv4) Validate

func (v *StringIsCIDRv4) Validate(e *validator.Errors)

Validate adds an error if the Field is not a valid CIDR notation of IPv4 address.

type StringIsCIDRv6

type StringIsCIDRv6 struct {
	Name    string
	Field   string
	Message string
}

StringIsCIDRv6 is a validator object. Validate adds an error if the Field is not a CIDR notation of IPv6 address.

func (*StringIsCIDRv6) SetField

func (v *StringIsCIDRv6) SetField(s string)

SetField sets validator field.

func (*StringIsCIDRv6) SetNameIndex

func (v *StringIsCIDRv6) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsCIDRv6) Validate

func (v *StringIsCIDRv6) Validate(e *validator.Errors)

Validate adds an error if the Field is not a CIDR notation of IPv6 address.

type StringIsDir

type StringIsDir struct {
	Name    string
	Field   string
	Message string
}

StringIsDir is a validator object. Validate adds an error if the Field is not a path to directory.

func (*StringIsDir) SetField

func (v *StringIsDir) SetField(s string)

SetField sets validator field.

func (*StringIsDir) SetNameIndex

func (v *StringIsDir) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsDir) Validate

func (v *StringIsDir) Validate(e *validator.Errors)

Validate adds an error if the Field is not a path to directory.

type StringIsDirWithModeSticky

type StringIsDirWithModeSticky struct {
	Name    string
	Field   string
	Message string
}

StringIsDirWithModeSticky is a validator object. Validate adds an error if the Field is not a dir or a dir without sticky mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsDirWithModeSticky) SetField

func (v *StringIsDirWithModeSticky) SetField(s string)

SetField sets validator field.

func (*StringIsDirWithModeSticky) SetNameIndex

func (v *StringIsDirWithModeSticky) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsDirWithModeSticky) Validate

func (v *StringIsDirWithModeSticky) Validate(e *validator.Errors)

Validate adds an error if the Field is not a dir or a dir without sticky mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsDirWithoutModeSticky

type StringIsDirWithoutModeSticky struct {
	Name    string
	Field   string
	Message string
}

StringIsDirWithoutModeSticky is a validator object. Validate adds an error if the Field is not a dir or a dir with mode sticky. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsDirWithoutModeSticky) SetField

func (v *StringIsDirWithoutModeSticky) SetField(s string)

SetField sets validator field.

func (*StringIsDirWithoutModeSticky) SetNameIndex

func (v *StringIsDirWithoutModeSticky) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsDirWithoutModeSticky) Validate

Validate adds an error if the Field is not a dir or a dir with mode sticky. If Field is a symlink, the symlink's target will be assessed.

type StringIsEmail

type StringIsEmail struct {
	Name    string
	Field   string
	Message string
}

StringIsEmail is a validator object. Validate adds an error if the Field does not match email regexp. See Email const.

func (*StringIsEmail) SetField

func (v *StringIsEmail) SetField(s string)

SetField sets validator field.

func (*StringIsEmail) SetNameIndex

func (v *StringIsEmail) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsEmail) Validate

func (v *StringIsEmail) Validate(e *validator.Errors)

Validate adds an error if the Field does not match email regexp. See Email const.

type StringIsEmailLike

type StringIsEmailLike struct {
	Name    string
	Field   string
	Message string
}

StringIsEmailLike is a validator object. Validate adds an error if the Field does not correspond to "username@domain" structure. It also checks that domain has a domain zone (but does not check if the zone is valid). Also allows inner and outer whitespaces.

func (*StringIsEmailLike) SetField

func (v *StringIsEmailLike) SetField(s string)

SetField sets validator field.

func (*StringIsEmailLike) SetNameIndex

func (v *StringIsEmailLike) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsEmailLike) Validate

func (v *StringIsEmailLike) Validate(e *validator.Errors)

Validate adds an error if the Field does not correspond to "username@domain" structure. It also checks that domain has a domain zone (but does not check if the zone is valid). Also allows inner and outer whitespaces.

type StringIsExistingGroup

type StringIsExistingGroup struct {
	Name    string
	Field   string
	Message string
}

StringIsExistingGroup is a validator object. Validate adds an error if the Field is a user group that does not exist.

func (*StringIsExistingGroup) SetField

func (v *StringIsExistingGroup) SetField(s string)

SetField sets validator field.

func (*StringIsExistingGroup) SetNameIndex

func (v *StringIsExistingGroup) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsExistingGroup) Validate

func (v *StringIsExistingGroup) Validate(e *validator.Errors)

Validate adds an error if the Field is a user group that does not exist.

type StringIsExistingUser

type StringIsExistingUser struct {
	Name    string
	Field   string
	Message string
}

StringIsExistingUser is a validator object. Validate adds an error if the Field is a user that does not exist.

func (*StringIsExistingUser) SetField

func (v *StringIsExistingUser) SetField(s string)

SetField sets validator field.

func (*StringIsExistingUser) SetNameIndex

func (v *StringIsExistingUser) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsExistingUser) Validate

func (v *StringIsExistingUser) Validate(e *validator.Errors)

Validate adds an error if the Field is a user that does not exist.

type StringIsFile

type StringIsFile struct {
	Name    string
	Field   string
	Message string
}

StringIsFile is a validator object. Validate adds an error if the Field is not a file.

func (*StringIsFile) SetField

func (v *StringIsFile) SetField(s string)

SetField sets validator field.

func (*StringIsFile) SetNameIndex

func (v *StringIsFile) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsFile) Validate

func (v *StringIsFile) Validate(e *validator.Errors)

Validate adds an error if the Field is not a file.

type StringIsFileAndIsExecutable

type StringIsFileAndIsExecutable struct {
	Name    string
	Field   string
	Message string
}

StringIsFileAndIsExecutable is a validator object. Validate adds an error if the Field is a file without execute bit set.

func (*StringIsFileAndIsExecutable) SetField

func (v *StringIsFileAndIsExecutable) SetField(s string)

SetField sets validator field.

func (*StringIsFileAndIsExecutable) SetNameIndex

func (v *StringIsFileAndIsExecutable) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsFileAndIsExecutable) Validate

Validate adds an error if the Field is a file without execute bit set.

type StringIsFileAndIsNotExecutable

type StringIsFileAndIsNotExecutable struct {
	Name    string
	Field   string
	Message string
}

StringIsFileAndIsNotExecutable is a validator object. Validate adds an error if the Field is a file with execute bit set.

func (*StringIsFileAndIsNotExecutable) SetField

func (v *StringIsFileAndIsNotExecutable) SetField(s string)

SetField sets validator field.

func (*StringIsFileAndIsNotExecutable) SetNameIndex

func (v *StringIsFileAndIsNotExecutable) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsFileAndIsNotExecutable) Validate

Validate adds an error if the Field is a file with execute bit set.

type StringIsFloat

type StringIsFloat struct {
	Name    string
	Field   string
	Message string
}

StringIsFloat is a validator object. Validate add an error if the Field is not a float. Empty string is valid.

func (*StringIsFloat) SetField

func (v *StringIsFloat) SetField(s string)

SetField sets validator field.

func (*StringIsFloat) SetNameIndex

func (v *StringIsFloat) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsFloat) Validate

func (v *StringIsFloat) Validate(e *validator.Errors)

Validate add an error if the Field is not a float. Empty string is valid.

type StringIsHTTPURL

type StringIsHTTPURL struct {
	Name    string
	Field   string
	Message string
}

StringIsHTTPURL is a validator object. Validate adds an error if the Field is not a correctly formatted URL.

func (*StringIsHTTPURL) SetField

func (v *StringIsHTTPURL) SetField(s string)

SetField sets validator field.

func (*StringIsHTTPURL) SetNameIndex

func (v *StringIsHTTPURL) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsHTTPURL) Validate

func (v *StringIsHTTPURL) Validate(e *validator.Errors)

Validate adds an error if the Field is not a correctly formatted URL.

type StringIsHash

type StringIsHash struct {
	Name      string
	Field     string
	Algorithm string
	Message   string
}

StringIsHash is a validator object. Validate adds an error if the Field is not formatted as a hash of provided type algorithm. Algorithm can be one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b'].

func (*StringIsHash) SetField

func (v *StringIsHash) SetField(s string)

SetField sets validator field.

func (*StringIsHash) SetNameIndex

func (v *StringIsHash) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsHash) Validate

func (v *StringIsHash) Validate(e *validator.Errors)

Validate adds an error if the Field is not formatted as a hash of provided type algorithm. Algorithm can be one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b'].

type StringIsHexadecimal

type StringIsHexadecimal struct {
	Name    string
	Field   string
	Message string
}

StringIsHexadecimal is a validator object. Validate adds an error if the Field is not in a hexadecimal format.

func (*StringIsHexadecimal) SetField

func (v *StringIsHexadecimal) SetField(s string)

SetField sets validator field.

func (*StringIsHexadecimal) SetNameIndex

func (v *StringIsHexadecimal) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsHexadecimal) Validate

func (v *StringIsHexadecimal) Validate(e *validator.Errors)

Validate adds an error if the Field is not in a hexadecimal format.

type StringIsHexcolor

type StringIsHexcolor struct {
	Name    string
	Field   string
	Message string
}

StringIsHexcolor is a validator object. Validate adds an error if the Field is not formatted as a hexadecimal color. Leading '#' is required (e.g. "#1f1f1F", "#F00").

func (*StringIsHexcolor) SetField

func (v *StringIsHexcolor) SetField(s string)

SetField sets validator field.

func (*StringIsHexcolor) SetNameIndex

func (v *StringIsHexcolor) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsHexcolor) Validate

func (v *StringIsHexcolor) Validate(e *validator.Errors)

Validate adds an error if the Field is not formatted as a hexadecimal color. Leading '#' is required (e.g. "#1f1f1F", "#F00").

type StringIsIP

type StringIsIP struct {
	Name    string
	Field   string
	Message string
}

StringIsIP is a validator object. Validate adds an error if the Field is a valid IP address version 4 or 6.

func (*StringIsIP) SetField

func (v *StringIsIP) SetField(s string)

SetField sets validator field.

func (*StringIsIP) SetNameIndex

func (v *StringIsIP) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIP) Validate

func (v *StringIsIP) Validate(e *validator.Errors)

Validate adds an error if the Field is a valid IP address version 4 or 6.

type StringIsIPGlobalUnicast

type StringIsIPGlobalUnicast struct {
	Name    string
	Field   string
	Message string
}

StringIsIPGlobalUnicast is a validator object. Validate adds an error if the Field is not a valid Global Unicast IP address. Error is not added if ip is in IPv4 private address space or local IPv6 unicast address space.

func (*StringIsIPGlobalUnicast) SetField

func (v *StringIsIPGlobalUnicast) SetField(s string)

SetField sets validator field.

func (*StringIsIPGlobalUnicast) SetNameIndex

func (v *StringIsIPGlobalUnicast) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPGlobalUnicast) Validate

func (v *StringIsIPGlobalUnicast) Validate(e *validator.Errors)

Validate adds an error if the Field is not a valid Global Unicast IP address. Error is not added if ip is in IPv4 private address space or local IPv6 unicast address space.

type StringIsIPHasPTR

type StringIsIPHasPTR struct {
	Name    string
	Field   string
	Message string
}

StringIsIPHasPTR is a validator object. Validate adds an error if the Field is an IP address that does not have PTR record.

func (*StringIsIPHasPTR) SetField

func (v *StringIsIPHasPTR) SetField(s string)

SetField sets validator field.

func (*StringIsIPHasPTR) SetNameIndex

func (v *StringIsIPHasPTR) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPHasPTR) Validate

func (v *StringIsIPHasPTR) Validate(e *validator.Errors)

Validate adds an error if the Field is an IP address that does not have PTR record.

type StringIsIPIfaceLocalMulticast

type StringIsIPIfaceLocalMulticast struct {
	Name    string
	Field   string
	Message string
}

StringIsIPIfaceLocalMulticast is a validator object. Validate adds an error if the Field is not an interface-local multicast address.

func (*StringIsIPIfaceLocalMulticast) SetField

func (v *StringIsIPIfaceLocalMulticast) SetField(s string)

SetField sets validator field.

func (*StringIsIPIfaceLocalMulticast) SetNameIndex

func (v *StringIsIPIfaceLocalMulticast) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPIfaceLocalMulticast) Validate

Validate adds an error if the Field is not an interface-local multicast address.

type StringIsIPLinkLocalMulticast

type StringIsIPLinkLocalMulticast struct {
	Name    string
	Field   string
	Message string
}

StringIsIPLinkLocalMulticast is a validator object. Validate adds an error if the Field is not a link-local multicast address.

func (*StringIsIPLinkLocalMulticast) SetField

func (v *StringIsIPLinkLocalMulticast) SetField(s string)

SetField sets validator field.

func (*StringIsIPLinkLocalMulticast) SetNameIndex

func (v *StringIsIPLinkLocalMulticast) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPLinkLocalMulticast) Validate

Validate adds an error if the Field is not a link-local multicast address.

type StringIsIPLinkLocalUnicast

type StringIsIPLinkLocalUnicast struct {
	Name    string
	Field   string
	Message string
}

StringIsIPLinkLocalUnicast is a validator object. Validate adds an error if the Field is not a link-local unicast address.

func (*StringIsIPLinkLocalUnicast) SetField

func (v *StringIsIPLinkLocalUnicast) SetField(s string)

SetField sets validator field.

func (*StringIsIPLinkLocalUnicast) SetNameIndex

func (v *StringIsIPLinkLocalUnicast) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPLinkLocalUnicast) Validate

Validate adds an error if the Field is not a link-local unicast address.

type StringIsIPLoopback

type StringIsIPLoopback struct {
	Name    string
	Field   string
	Message string
}

StringIsIPLoopback is a validator object. Validate adds an error if the Field is not a loopback address.

func (*StringIsIPLoopback) SetField

func (v *StringIsIPLoopback) SetField(s string)

SetField sets validator field.

func (*StringIsIPLoopback) SetNameIndex

func (v *StringIsIPLoopback) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPLoopback) Validate

func (v *StringIsIPLoopback) Validate(e *validator.Errors)

Validate adds an error if the Field is not a loopback address.

type StringIsIPMulticast

type StringIsIPMulticast struct {
	Name    string
	Field   string
	Message string
}

StringIsIPMulticast is a validator object. Validate adds an error if the Field is not a multicast address.

func (*StringIsIPMulticast) SetField

func (v *StringIsIPMulticast) SetField(s string)

SetField sets validator field.

func (*StringIsIPMulticast) SetNameIndex

func (v *StringIsIPMulticast) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPMulticast) Validate

func (v *StringIsIPMulticast) Validate(e *validator.Errors)

Validate adds an error if the Field is not a multicast address.

type StringIsIPUnspec

type StringIsIPUnspec struct {
	Name    string
	Field   string
	Message string
}

StringIsIPUnspec is a validator object. Validate adds an error if the Field is not an unspecified address, either the IPv4 address "0.0.0.0" or the IPv6 address.

func (*StringIsIPUnspec) SetField

func (v *StringIsIPUnspec) SetField(s string)

SetField sets validator field.

func (*StringIsIPUnspec) SetNameIndex

func (v *StringIsIPUnspec) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPUnspec) Validate

func (v *StringIsIPUnspec) Validate(e *validator.Errors)

Validate adds an error if the Field is not an unspecified address, either the IPv4 address "0.0.0.0" or the IPv6 address.

type StringIsIPv4

type StringIsIPv4 struct {
	Name    string
	Field   string
	Message string
}

StringIsIPv4 is a validator object. Validate adds an error if the Field is not a valid IPv4 address.

func (*StringIsIPv4) SetField

func (v *StringIsIPv4) SetField(s string)

SetField sets validator field.

func (*StringIsIPv4) SetNameIndex

func (v *StringIsIPv4) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPv4) Validate

func (v *StringIsIPv4) Validate(e *validator.Errors)

Validate adds an error if the Field is not a valid IPv4 address.

type StringIsIPv6

type StringIsIPv6 struct {
	Name    string
	Field   string
	Message string
}

StringIsIPv6 is a validator object. Validate adds an error if the Field is not a valid IPv6 address.

func (*StringIsIPv6) SetField

func (v *StringIsIPv6) SetField(s string)

SetField sets validator field.

func (*StringIsIPv6) SetNameIndex

func (v *StringIsIPv6) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsIPv6) Validate

func (v *StringIsIPv6) Validate(e *validator.Errors)

Validate adds an error if the Field is not a valid IPv6 address.

type StringIsInt

type StringIsInt struct {
	Name    string
	Field   string
	Message string
}

StringIsInt is a validator object. Validate adds an error if the Field is not an integer. Leading sign is allowed. Empty string is valid.

func (*StringIsInt) SetField

func (v *StringIsInt) SetField(s string)

SetField sets validator field.

func (*StringIsInt) SetNameIndex

func (v *StringIsInt) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsInt) Validate

func (v *StringIsInt) Validate(e *validator.Errors)

Validate adds an error if the Field is not an integer. Leading sign is allowed. Empty string is valid.

type StringIsJSON

type StringIsJSON struct {
	Name    string
	Field   string
	Message string
}

StringIsJSON is a validator object. Validate adds an error if the Field is not a valid JSON.

func (*StringIsJSON) SetField

func (v *StringIsJSON) SetField(s string)

SetField sets validator field.

func (*StringIsJSON) SetNameIndex

func (v *StringIsJSON) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsJSON) Validate

func (v *StringIsJSON) Validate(e *validator.Errors)

Validate adds an error if the Field is not a valid JSON.

type StringIsLowerCase

type StringIsLowerCase struct {
	Name    string
	Field   string
	Message string
}

StringIsLowerCase is a validator object. Validate adds an error if the Field is not lowercased. Empty string is valid.

func (*StringIsLowerCase) SetField

func (v *StringIsLowerCase) SetField(s string)

SetField sets validator field.

func (*StringIsLowerCase) SetNameIndex

func (v *StringIsLowerCase) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsLowerCase) Validate

func (v *StringIsLowerCase) Validate(e *validator.Errors)

Validate adds an error if the Field is not lowercased. Empty string is valid.

type StringIsMAC

type StringIsMAC struct {
	Name    string
	Field   string
	Message string
}

StringIsMAC is a validator object. Validate adds an error if the Field is not a MAC address.

func (*StringIsMAC) SetField

func (v *StringIsMAC) SetField(s string)

SetField sets validator field.

func (*StringIsMAC) SetNameIndex

func (v *StringIsMAC) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsMAC) Validate

func (v *StringIsMAC) Validate(e *validator.Errors)

Validate adds an error if the Field is not a MAC address.

type StringIsNotDir

type StringIsNotDir struct {
	Name    string
	Field   string
	Message string
}

StringIsNotDir is a validator object. Validate adds an error if the Field is a path to directory.

func (*StringIsNotDir) SetField

func (v *StringIsNotDir) SetField(s string)

SetField sets validator field.

func (*StringIsNotDir) SetNameIndex

func (v *StringIsNotDir) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotDir) Validate

func (v *StringIsNotDir) Validate(e *validator.Errors)

Validate adds an error if the Field is a path to directory.

type StringIsNotExistingGroup

type StringIsNotExistingGroup struct {
	Name    string
	Field   string
	Message string
}

StringIsNotExistingGroup is a validator object. Validate adds an error if the Field is a user group that exists.

func (*StringIsNotExistingGroup) SetField

func (v *StringIsNotExistingGroup) SetField(s string)

SetField sets validator field.

func (*StringIsNotExistingGroup) SetNameIndex

func (v *StringIsNotExistingGroup) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotExistingGroup) Validate

func (v *StringIsNotExistingGroup) Validate(e *validator.Errors)

Validate adds an error if the Field is a user group that exists.

type StringIsNotExistingUser

type StringIsNotExistingUser struct {
	Name    string
	Field   string
	Message string
}

StringIsNotExistingUser is a validator object. Validate adds an error if the Field is an existing user.

func (*StringIsNotExistingUser) SetField

func (v *StringIsNotExistingUser) SetField(s string)

SetField sets validator field.

func (*StringIsNotExistingUser) SetNameIndex

func (v *StringIsNotExistingUser) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotExistingUser) Validate

func (v *StringIsNotExistingUser) Validate(e *validator.Errors)

Validate adds an error if the Field is an existing user.

type StringIsNotFile

type StringIsNotFile struct {
	Name    string
	Field   string
	Message string
}

StringIsNotFile is a validator object. Validate adds an error if the Field is a file.

func (*StringIsNotFile) SetField

func (v *StringIsNotFile) SetField(s string)

SetField sets validator field.

func (*StringIsNotFile) SetNameIndex

func (v *StringIsNotFile) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotFile) Validate

func (v *StringIsNotFile) Validate(e *validator.Errors)

Validate adds an error if the Field is a file.

type StringIsNotNumeric

type StringIsNotNumeric struct {
	Name    string
	Field   string
	Message string
}

StringIsNotNumeric is a validator object. Validate adds an error if the Field is numeric.

func (*StringIsNotNumeric) SetField

func (v *StringIsNotNumeric) SetField(s string)

SetField sets validator field.

func (*StringIsNotNumeric) SetNameIndex

func (v *StringIsNotNumeric) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotNumeric) Validate

func (v *StringIsNotNumeric) Validate(e *validator.Errors)

Validate adds an error if the Field is numeric.

type StringIsNotPath

type StringIsNotPath struct {
	Name    string
	Field   string
	Message string
}

StringIsNotPath is a validator object. Validate adds an error if the Field is an existing path.

func (*StringIsNotPath) SetField

func (v *StringIsNotPath) SetField(s string)

SetField sets validator field.

func (*StringIsNotPath) SetNameIndex

func (v *StringIsNotPath) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotPath) Validate

func (v *StringIsNotPath) Validate(e *validator.Errors)

Validate adds an error if the Field is an existing path.

type StringIsNotRegularUser

type StringIsNotRegularUser struct {
	Name    string
	Field   string
	Message string
}

StringIsNotRegularUser is a validator object.

func (*StringIsNotRegularUser) SetField

func (v *StringIsNotRegularUser) SetField(s string)

SetField sets validator field.

func (*StringIsNotRegularUser) SetNameIndex

func (v *StringIsNotRegularUser) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotRegularUser) Validate

func (v *StringIsNotRegularUser) Validate(e *validator.Errors)

Validate adds an error if the Field is a regular user.

type StringIsNotResolvableHostname

type StringIsNotResolvableHostname struct {
	Name    string
	Field   string
	Message string
}

StringIsNotResolvableHostname is a validator object. Validate adds an error if the Field is a resolvable hostname.

func (*StringIsNotResolvableHostname) SetField

func (v *StringIsNotResolvableHostname) SetField(s string)

SetField sets validator field.

func (*StringIsNotResolvableHostname) SetNameIndex

func (v *StringIsNotResolvableHostname) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotResolvableHostname) Validate

Validate adds an error if the Field is a resolvable hostname.

type StringIsNotResolvableHostnameNorIP

type StringIsNotResolvableHostnameNorIP struct {
	Name    string
	Field   string
	Message string
}

StringIsNotResolvableHostnameNorIP is a validator object. Validate adds an error if the Field is a resolvable hostname or an IP address.

func (*StringIsNotResolvableHostnameNorIP) SetField

SetField sets validator field.

func (*StringIsNotResolvableHostnameNorIP) SetNameIndex

func (v *StringIsNotResolvableHostnameNorIP) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotResolvableHostnameNorIP) Validate

Validate adds an error if the Field is a resolvable hostname or an IP address.

type StringIsNotResolvableHostnameNorIPv4

type StringIsNotResolvableHostnameNorIPv4 struct {
	Name    string
	Field   string
	Message string
}

StringIsNotResolvableHostnameNorIPv4 is a validator object. Validate adds an error if the Field is a resolvable hostname or an IPv4 address.

func (*StringIsNotResolvableHostnameNorIPv4) SetField

SetField sets validator field.

func (*StringIsNotResolvableHostnameNorIPv4) SetNameIndex

func (v *StringIsNotResolvableHostnameNorIPv4) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotResolvableHostnameNorIPv4) Validate

Validate adds an error if the Field is a resolvable hostname or an IPv4 address.

type StringIsNotResolvableHostnameNorIPv6

type StringIsNotResolvableHostnameNorIPv6 struct {
	Name    string
	Field   string
	Message string
}

StringIsNotResolvableHostnameNorIPv6 is a validator object. Validate adds an error if the Field is a resolvable hostname or an IPv6 address.

func (*StringIsNotResolvableHostnameNorIPv6) SetField

SetField sets validator field.

func (*StringIsNotResolvableHostnameNorIPv6) SetNameIndex

func (v *StringIsNotResolvableHostnameNorIPv6) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotResolvableHostnameNorIPv6) Validate

Validate adds an error if the Field is a resolvable hostname or an IPv6 address.

type StringIsNotSymlink struct {
	Name    string
	Field   string
	Message string
}

StringIsNotSymlink is a validator object. Validate adds an error if the Field is a symlink.

func (*StringIsNotSymlink) SetField

func (v *StringIsNotSymlink) SetField(s string)

SetField sets validator field.

func (*StringIsNotSymlink) SetNameIndex

func (v *StringIsNotSymlink) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotSymlink) Validate

func (v *StringIsNotSymlink) Validate(e *validator.Errors)

Validate adds an error if the Field is a symlink.

type StringIsNotUserGroup

type StringIsNotUserGroup struct {
	Name    string
	Field   string
	Message string
}

StringIsNotUserGroup is a validator object. Validate adds an error if the Field is a user group.

func (*StringIsNotUserGroup) SetField

func (v *StringIsNotUserGroup) SetField(s string)

SetField sets validator field.

func (*StringIsNotUserGroup) SetNameIndex

func (v *StringIsNotUserGroup) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNotUserGroup) Validate

func (v *StringIsNotUserGroup) Validate(e *validator.Errors)

Validate adds an error if the Field is a user group.

type StringIsNull

type StringIsNull struct {
	Name    string
	Field   string
	Message string
}

StringIsNull is a validator object. Validate adds an error if the Field is an empty string. Emptry string is defined as such with length 0. If you want to allow whitespaces - see StringIsPresent validator.

func (*StringIsNull) SetField

func (v *StringIsNull) SetField(s string)

SetField sets validator field.

func (*StringIsNull) SetNameIndex

func (v *StringIsNull) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNull) Validate

func (v *StringIsNull) Validate(e *validator.Errors)

Validate adds an error if the Field is an empty string. Emptry string is defined as such with length 0. If you want to allow whitespaces - see StringIsPresent validator.

type StringIsNumeric

type StringIsNumeric struct {
	Name    string
	Field   string
	Message string
}

StringIsNumeric is a validator object. Validate adds an error if the Field is not numeric. Empty string is valid.

func (*StringIsNumeric) SetField

func (v *StringIsNumeric) SetField(s string)

SetField sets validator field.

func (*StringIsNumeric) SetNameIndex

func (v *StringIsNumeric) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsNumeric) Validate

func (v *StringIsNumeric) Validate(e *validator.Errors)

Validate adds an error if the Field is not numeric. Empty string is valid.

type StringIsPath

type StringIsPath struct {
	Name    string
	Field   string
	Message string
}

StringIsPath is a validator object. Validate adds an error if the Field is a path that does not exist.

func (*StringIsPath) SetField

func (v *StringIsPath) SetField(s string)

SetField sets validator field.

func (*StringIsPath) SetNameIndex

func (v *StringIsPath) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPath) Validate

func (v *StringIsPath) Validate(e *validator.Errors)

Validate adds an error if the Field is a path that does not exist.

type StringIsPathAndCharDevice

type StringIsPathAndCharDevice struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndCharDevice is a validator object. Validate adds an error if the Field is not an existing path or is an existing path without CharDevice mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndCharDevice) SetField

func (v *StringIsPathAndCharDevice) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndCharDevice) SetNameIndex

func (v *StringIsPathAndCharDevice) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndCharDevice) Validate

func (v *StringIsPathAndCharDevice) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path without CharDevice mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathAndDevice

type StringIsPathAndDevice struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndDevice is a validator object. Validate adds an error if the Field is not an existing path or is an existing path without Device mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndDevice) SetField

func (v *StringIsPathAndDevice) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndDevice) SetNameIndex

func (v *StringIsPathAndDevice) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndDevice) Validate

func (v *StringIsPathAndDevice) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path without Device mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathAndIrregularFile

type StringIsPathAndIrregularFile struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndIrregularFile is a validator object. Validate adds an error if the Field is not an existing path or is an existing path without Irregular mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndIrregularFile) SetField

func (v *StringIsPathAndIrregularFile) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndIrregularFile) SetNameIndex

func (v *StringIsPathAndIrregularFile) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndIrregularFile) Validate

Validate adds an error if the Field is not an existing path or is an existing path without Irregular mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathAndIsWritable

type StringIsPathAndIsWritable struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndIsWritable is a validator object. Validate adds an error if the Field is a path and is not writable.

func (*StringIsPathAndIsWritable) SetField

func (v *StringIsPathAndIsWritable) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndIsWritable) SetNameIndex

func (v *StringIsPathAndIsWritable) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndIsWritable) Validate

func (v *StringIsPathAndIsWritable) Validate(e *validator.Errors)

Validate adds an error if the Field is a path and is not writable.

type StringIsPathAndNamedPipe

type StringIsPathAndNamedPipe struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndNamedPipe is a validator object. Validate adds an error if the Field is not an existing path or is an existing path without NamedPipe mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndNamedPipe) SetField

func (v *StringIsPathAndNamedPipe) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndNamedPipe) SetNameIndex

func (v *StringIsPathAndNamedPipe) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndNamedPipe) Validate

func (v *StringIsPathAndNamedPipe) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path without NamedPipe mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathAndNotCharDevice

type StringIsPathAndNotCharDevice struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndNotCharDevice is a validator object. Validate adds an error if the Field is not an existing path or is an existing path with CharDevice mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndNotCharDevice) SetField

func (v *StringIsPathAndNotCharDevice) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndNotCharDevice) SetNameIndex

func (v *StringIsPathAndNotCharDevice) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndNotCharDevice) Validate

Validate adds an error if the Field is not an existing path or is an existing path with CharDevice mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathAndNotDevice

type StringIsPathAndNotDevice struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndNotDevice is a validator object. Validate adds an error if the Field is not an existing path or is an existing path with Device mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndNotDevice) SetField

func (v *StringIsPathAndNotDevice) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndNotDevice) SetNameIndex

func (v *StringIsPathAndNotDevice) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndNotDevice) Validate

func (v *StringIsPathAndNotDevice) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path with Device mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathAndNotNamedPipe

type StringIsPathAndNotNamedPipe struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndNotNamedPipe is a validator object. Validate adds an error if the Field is not an existing path or is an existing path with NamedPipe mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndNotNamedPipe) SetField

func (v *StringIsPathAndNotNamedPipe) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndNotNamedPipe) SetNameIndex

func (v *StringIsPathAndNotNamedPipe) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndNotNamedPipe) Validate

Validate adds an error if the Field is not an existing path or is an existing path with NamedPipe mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathAndNotSocket

type StringIsPathAndNotSocket struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndNotSocket is a validator object. Validate adds an error if the Field is not an existing path or is an existing path with Socket mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndNotSocket) SetField

func (v *StringIsPathAndNotSocket) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndNotSocket) SetNameIndex

func (v *StringIsPathAndNotSocket) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndNotSocket) Validate

func (v *StringIsPathAndNotSocket) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path with Socket mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathAndRegularFile

type StringIsPathAndRegularFile struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndRegularFile is a validator object. Validate adds an error if the Field is not an existing path or is an existing non-regular file. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndRegularFile) SetField

func (v *StringIsPathAndRegularFile) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndRegularFile) SetNameIndex

func (v *StringIsPathAndRegularFile) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndRegularFile) Validate

Validate adds an error if the Field is not an existing path or is an existing non-regular file. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathAndSocket

type StringIsPathAndSocket struct {
	Name    string
	Field   string
	Message string
}

StringIsPathAndSocket is a validator object. Validate adds an error if the Field is not an existing path or is an existing path without Socket mode. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathAndSocket) SetField

func (v *StringIsPathAndSocket) SetField(s string)

SetField sets validator field.

func (*StringIsPathAndSocket) SetNameIndex

func (v *StringIsPathAndSocket) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathAndSocket) Validate

func (v *StringIsPathAndSocket) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path without Socket mode. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathWithSetGID

type StringIsPathWithSetGID struct {
	Name    string
	Field   string
	Message string
}

StringIsPathWithSetGID is a validator object. Validate adds an error if the Field is not an existing path or is an existing path without SetGID flag. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathWithSetGID) SetField

func (v *StringIsPathWithSetGID) SetField(s string)

SetField sets validator field.

func (*StringIsPathWithSetGID) SetNameIndex

func (v *StringIsPathWithSetGID) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathWithSetGID) Validate

func (v *StringIsPathWithSetGID) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path without SetGID flag. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathWithSetUID

type StringIsPathWithSetUID struct {
	Name    string
	Field   string
	Message string
}

StringIsPathWithSetUID is a validator object. Validate adds an error if the Field is not an existing path or is an existing path without SetUID flag. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathWithSetUID) SetField

func (v *StringIsPathWithSetUID) SetField(s string)

SetField sets validator field.

func (*StringIsPathWithSetUID) SetNameIndex

func (v *StringIsPathWithSetUID) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathWithSetUID) Validate

func (v *StringIsPathWithSetUID) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path without SetUID flag. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathWithoutSetGID

type StringIsPathWithoutSetGID struct {
	Name    string
	Field   string
	Message string
}

StringIsPathWithoutSetGID is a validator object. Validate adds an error if the Field is not an existing path or is an existing path with SetGID flag. If Field is a symlink, the symlink's target will be assessed.

func (*StringIsPathWithoutSetGID) SetField

func (v *StringIsPathWithoutSetGID) SetField(s string)

SetField sets validator field.

func (*StringIsPathWithoutSetGID) SetNameIndex

func (v *StringIsPathWithoutSetGID) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathWithoutSetGID) Validate

func (v *StringIsPathWithoutSetGID) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path with SetGID flag. If Field is a symlink, the symlink's target will be assessed.

type StringIsPathWithoutSetUID

type StringIsPathWithoutSetUID struct {
	Name    string
	Field   string
	Message string
}

StringIsPathWithoutSetUID is a validator object.

func (*StringIsPathWithoutSetUID) SetField

func (v *StringIsPathWithoutSetUID) SetField(s string)

SetField sets validator field.

func (*StringIsPathWithoutSetUID) SetNameIndex

func (v *StringIsPathWithoutSetUID) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPathWithoutSetUID) Validate

func (v *StringIsPathWithoutSetUID) Validate(e *validator.Errors)

Validate adds an error if the Field is not an existing path or is an existing path with SetGID flag. If Field is a symlink, the symlink's target will be assessed.

type StringIsPort

type StringIsPort struct {
	Name    string
	Field   string
	Message string
}

StringIsPort is a validator object. Validate adds an error if the Field does not represent a valid port.

func (*StringIsPort) SetField

func (v *StringIsPort) SetField(s string)

SetField sets validator field.

func (*StringIsPort) SetNameIndex

func (v *StringIsPort) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPort) Validate

func (v *StringIsPort) Validate(e *validator.Errors)

Validate adds an error if the Field does not represent a valid port.

type StringIsPresent

type StringIsPresent struct {
	Name    string
	Field   string
	Message string
}

StringIsPresent is a validator object. Validate adds an error if the Field is empty or has only whitespaces. If you don't want whitespaces - see StringIsNull validator.

func (*StringIsPresent) SetField

func (v *StringIsPresent) SetField(s string)

SetField sets validator field.

func (*StringIsPresent) SetNameIndex

func (v *StringIsPresent) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPresent) Validate

func (v *StringIsPresent) Validate(e *validator.Errors)

Validate adds an error if the Field is empty or has only whitespaces. If you don't want whitespaces - see StringIsNull validator.

type StringIsPrintableASCII

type StringIsPrintableASCII struct {
	Name    string
	Field   string
	Message string
}

StringIsPrintableASCII is a validator object. Validate adds an error if the Field contains anything except for printable ASCII characters. Empty string is valid.

func (*StringIsPrintableASCII) SetField

func (v *StringIsPrintableASCII) SetField(s string)

SetField sets validator field.

func (*StringIsPrintableASCII) SetNameIndex

func (v *StringIsPrintableASCII) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsPrintableASCII) Validate

func (v *StringIsPrintableASCII) Validate(e *validator.Errors)

Validate adds an error if the Field contains anything except for printable ASCII characters. Empty string is valid.

type StringIsRGBcolor

type StringIsRGBcolor struct {
	Name    string
	Field   string
	Message string
}

StringIsRGBcolor is a validator object. Validate adds an error if the Field is not formatted as an RGB color. Expected format is "rgb(RRR, GGG, BBB)".

func (*StringIsRGBcolor) SetField

func (v *StringIsRGBcolor) SetField(s string)

SetField sets validator field.

func (*StringIsRGBcolor) SetNameIndex

func (v *StringIsRGBcolor) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsRGBcolor) Validate

func (v *StringIsRGBcolor) Validate(e *validator.Errors)

Validate adds an error if the Field is not formatted as an RGB color. Expected format is "rgb(RRR, GGG, BBB)".

type StringIsRegularUserOrWhitelisted

type StringIsRegularUserOrWhitelisted struct {
	Name      string
	Field     string
	Whitelist []string
	Message   string
}

StringIsRegularUserOrWhitelisted is a validator object. Validate adds an error if the Field is not a regular user or whitelisted.

func (*StringIsRegularUserOrWhitelisted) SetField

SetField sets validator field.

func (*StringIsRegularUserOrWhitelisted) SetNameIndex

func (v *StringIsRegularUserOrWhitelisted) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsRegularUserOrWhitelisted) Validate

Validate adds an error if the Field is not a regular user or whitelisted.

type StringIsResolvableHostname

type StringIsResolvableHostname struct {
	Name    string
	Field   string
	Message string
}

StringIsResolvableHostname is a validator object. Validate adds an error if the Field is not a resolvable hostname.

func (*StringIsResolvableHostname) SetField

func (v *StringIsResolvableHostname) SetField(s string)

SetField sets validator field.

func (*StringIsResolvableHostname) SetNameIndex

func (v *StringIsResolvableHostname) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsResolvableHostname) Validate

Validate adds an error if the Field is not a resolvable hostname.

type StringIsResolvableHostnameOrIP

type StringIsResolvableHostnameOrIP struct {
	Name    string
	Field   string
	Message string
}

StringIsResolvableHostnameOrIP is a validator object. Validate adds an error if the Field is not a resolvable hostname and not an IP address.

func (*StringIsResolvableHostnameOrIP) SetField

func (v *StringIsResolvableHostnameOrIP) SetField(s string)

SetField sets validator field.

func (*StringIsResolvableHostnameOrIP) SetNameIndex

func (v *StringIsResolvableHostnameOrIP) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsResolvableHostnameOrIP) Validate

Validate adds an error if the Field is not a resolvable hostname and not an IP address.

type StringIsResolvableHostnameOrIPv4

type StringIsResolvableHostnameOrIPv4 struct {
	Name    string
	Field   string
	Message string
}

StringIsResolvableHostnameOrIPv4 is a validator object. Validate adds an error if the Field is not a resolvable hostname and not an IPv4 address.

func (*StringIsResolvableHostnameOrIPv4) SetField

SetField sets validator field.

func (*StringIsResolvableHostnameOrIPv4) SetNameIndex

func (v *StringIsResolvableHostnameOrIPv4) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsResolvableHostnameOrIPv4) Validate

Validate adds an error if the Field is not a resolvable hostname and not an IPv4 address.

type StringIsResolvableHostnameOrIPv6

type StringIsResolvableHostnameOrIPv6 struct {
	Name    string
	Field   string
	Message string
}

StringIsResolvableHostnameOrIPv6 is a validator object. Validate adds an error if the Field is not a resolvable hostname and not an IPv6 address.

func (*StringIsResolvableHostnameOrIPv6) SetField

SetField sets validator field.

func (*StringIsResolvableHostnameOrIPv6) SetNameIndex

func (v *StringIsResolvableHostnameOrIPv6) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsResolvableHostnameOrIPv6) Validate

Validate adds an error if the Field is not a resolvable hostname and not an IPv6 address.

type StringIsSymlink struct {
	Name    string
	Field   string
	Message string
}

StringIsSymlink is a validator object. Validate adds an error if the Field is not a symlink.

func (*StringIsSymlink) SetField

func (v *StringIsSymlink) SetField(s string)

SetField sets validator field.

func (*StringIsSymlink) SetNameIndex

func (v *StringIsSymlink) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsSymlink) Validate

func (v *StringIsSymlink) Validate(e *validator.Errors)

Validate adds an error if the Field is not a symlink.

type StringIsSymlinkAndTargetIsDir

type StringIsSymlinkAndTargetIsDir struct {
	Name    string
	Field   string
	Message string
}

StringIsSymlinkAndTargetIsDir is a validator object. Validate adds an error if the Field is a symlink and it's target is not a directory.

func (*StringIsSymlinkAndTargetIsDir) SetField

func (v *StringIsSymlinkAndTargetIsDir) SetField(s string)

SetField sets validator field.

func (*StringIsSymlinkAndTargetIsDir) SetNameIndex

func (v *StringIsSymlinkAndTargetIsDir) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsSymlinkAndTargetIsDir) Validate

Validate adds an error if the Field is a symlink and it's target is not a directory.

type StringIsSymlinkAndTargetIsNotDir

type StringIsSymlinkAndTargetIsNotDir struct {
	Name    string
	Field   string
	Message string
}

StringIsSymlinkAndTargetIsNotDir is a validator object. Validate adds an error if the Field is a symlink and it's target is a directory.

func (*StringIsSymlinkAndTargetIsNotDir) SetField

SetField sets validator field.

func (*StringIsSymlinkAndTargetIsNotDir) SetNameIndex

func (v *StringIsSymlinkAndTargetIsNotDir) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsSymlinkAndTargetIsNotDir) Validate

Validate adds an error if the Field is a symlink and it's target is a directory.

type StringIsSymlinkAndTargetIsNotPath

type StringIsSymlinkAndTargetIsNotPath struct {
	Name    string
	Field   string
	Message string
}

StringIsSymlinkAndTargetIsNotPath is a validator object. Validate adds an error if the Field is a symlink and it's target is an existing path.

func (*StringIsSymlinkAndTargetIsNotPath) SetField

SetField sets validator field.

func (*StringIsSymlinkAndTargetIsNotPath) SetNameIndex

func (v *StringIsSymlinkAndTargetIsNotPath) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsSymlinkAndTargetIsNotPath) Validate

Validate adds an error if the Field is a symlink and it's target is an existing path.

type StringIsSymlinkAndTargetIsPath

type StringIsSymlinkAndTargetIsPath struct {
	Name    string
	Field   string
	Message string
}

StringIsSymlinkAndTargetIsPath is a validator object. Validate adds an error if the Field is a symlink and it's target is not an existing path.

func (*StringIsSymlinkAndTargetIsPath) SetField

func (v *StringIsSymlinkAndTargetIsPath) SetField(s string)

SetField sets validator field.

func (*StringIsSymlinkAndTargetIsPath) SetNameIndex

func (v *StringIsSymlinkAndTargetIsPath) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsSymlinkAndTargetIsPath) Validate

Validate adds an error if the Field is a symlink and it's target is not an existing path.

type StringIsUTFLetterNum

type StringIsUTFLetterNum struct {
	Name    string
	Field   string
	Message string
}

StringIsUTFLetterNum is a validator object. Validate adds an error if the Field contains anything except unicode letters/numbers (category L/N). Empty string is valid.

func (*StringIsUTFLetterNum) SetField

func (v *StringIsUTFLetterNum) SetField(s string)

SetField sets validator field.

func (*StringIsUTFLetterNum) SetNameIndex

func (v *StringIsUTFLetterNum) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsUTFLetterNum) Validate

func (v *StringIsUTFLetterNum) Validate(e *validator.Errors)

Validate adds an error if the Field contains anything except unicode letters/numbers (category L/N). Empty string is valid.

type StringIsUTFLetters

type StringIsUTFLetters struct {
	Name    string
	Field   string
	Message string
}

StringIsUTFLetters is a validator object. Validate adds an error if the Field contains anything except unicode letters (category L) Similar to StringIsAlpha but for all languages. Empty string is valid.

func (*StringIsUTFLetters) SetField

func (v *StringIsUTFLetters) SetField(s string)

SetField sets validator field.

func (*StringIsUTFLetters) SetNameIndex

func (v *StringIsUTFLetters) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsUTFLetters) Validate

func (v *StringIsUTFLetters) Validate(e *validator.Errors)

Validate adds an error if the Field contains anything except unicode letters (category L) Similar to StringIsAlpha but for all languages. Empty string is valid.

type StringIsUTFNumeric

type StringIsUTFNumeric struct {
	Name    string
	Field   string
	Message string
}

StringIsUTFNumeric is a validator object. Validate adds an error if the Field contains anything except unicode numbers (category N). Leading sign is allowed. Empty string is valid.

func (*StringIsUTFNumeric) SetField

func (v *StringIsUTFNumeric) SetField(s string)

SetField sets validator field.

func (*StringIsUTFNumeric) SetNameIndex

func (v *StringIsUTFNumeric) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsUTFNumeric) Validate

func (v *StringIsUTFNumeric) Validate(e *validator.Errors)

Validate adds an error if the Field contains anything except unicode numbers (category N). Leading sign is allowed. Empty string is valid.

type StringIsUnixFilePermission

type StringIsUnixFilePermission struct {
	Name    string
	Field   string
	Message string
}

StringIsUnixFilePermission is a validator object. Validate adds an error if the Field is not a unix file permission.

func (*StringIsUnixFilePermission) SetField

func (v *StringIsUnixFilePermission) SetField(s string)

SetField sets validator field.

func (*StringIsUnixFilePermission) SetNameIndex

func (v *StringIsUnixFilePermission) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsUnixFilePermission) Validate

Validate adds an error if the Field is not a unix file permission.

type StringIsUpperCase

type StringIsUpperCase struct {
	Name    string
	Field   string
	Message string
}

StringIsUpperCase is a validator object. Validate adds an error if the Field is not uppercased. Empty string is valid.

func (*StringIsUpperCase) SetField

func (v *StringIsUpperCase) SetField(s string)

SetField sets validator field.

func (*StringIsUpperCase) SetNameIndex

func (v *StringIsUpperCase) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsUpperCase) Validate

func (v *StringIsUpperCase) Validate(e *validator.Errors)

Validate adds an error if the Field is not uppercased. Empty string is valid.

type StringIsUserGroupOrWhitelisted

type StringIsUserGroupOrWhitelisted struct {
	Name      string
	Field     string
	Whitelist []string
	Message   string
}

StringIsUserGroupOrWhitelisted is a validator object. Validate adds an error if the Field is not a user group or whitelisted.

func (*StringIsUserGroupOrWhitelisted) SetField

func (v *StringIsUserGroupOrWhitelisted) SetField(s string)

SetField sets validator field.

func (*StringIsUserGroupOrWhitelisted) SetNameIndex

func (v *StringIsUserGroupOrWhitelisted) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsUserGroupOrWhitelisted) Validate

Validate adds an error if the Field is not a user group or whitelisted.

type StringIsValidShadowPassword

type StringIsValidShadowPassword struct {
	Name    string
	Field   string
	Message string
}

StringIsValidShadowPassword is a validator object. Validate adds an error if the Field is not a valid shadow password.

func (*StringIsValidShadowPassword) SetField

func (v *StringIsValidShadowPassword) SetField(s string)

SetField sets validator field.

func (*StringIsValidShadowPassword) SetNameIndex

func (v *StringIsValidShadowPassword) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsValidShadowPassword) Validate

Validate adds an error if the Field is not a valid shadow password.

type StringIsValidUserOrGroupName

type StringIsValidUserOrGroupName struct {
	Name    string
	Field   string
	Message string
}

StringIsValidUserOrGroupName is a validator object. Validate adds an error if the Field is not a valid user or group name.

func (*StringIsValidUserOrGroupName) SetField

func (v *StringIsValidUserOrGroupName) SetField(s string)

SetField sets validator field.

func (*StringIsValidUserOrGroupName) SetNameIndex

func (v *StringIsValidUserOrGroupName) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringIsValidUserOrGroupName) Validate

Validate adds an error if the Field is not a valid user or group name.

type StringLengthInRange

type StringLengthInRange struct {
	Name    string
	Field   string
	Min     int
	Max     int
	Message string
}

StringLengthInRange is a validator object. Validate adds an error if the Field length is not in range between Min and Max (inclusive). If only Min provided - Max=length of string. If only Max provided - Min=0. It is possible to provide either both or one of the Min/Max values.

func (*StringLengthInRange) SetField

func (v *StringLengthInRange) SetField(s string)

SetField sets validator field.

func (*StringLengthInRange) SetNameIndex

func (v *StringLengthInRange) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringLengthInRange) Validate

func (v *StringLengthInRange) Validate(e *validator.Errors)

Validate adds an error if the Field length is not in range between Min and Max (inclusive). If only Min provided - Max=length of string. If only Max provided - Min=0. It is possible to provide either both or one of the Min/Max values.

type StringMatchRegex

type StringMatchRegex struct {
	Name    string
	Field   string
	Regex   string
	Message string
}

StringMatchRegex is a validator object. Validate adds an error if the Field does not match regular expression Regex.

func (*StringMatchRegex) SetField

func (v *StringMatchRegex) SetField(s string)

SetField sets validator field.

func (*StringMatchRegex) SetNameIndex

func (v *StringMatchRegex) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringMatchRegex) Validate

func (v *StringMatchRegex) Validate(e *validator.Errors)

Validate adds an error if the Field does not match regular expression Regex.

type StringSliceDive

type StringSliceDive struct {
	Validator StringValidator
	Field     []string
}

StringSliceDive is a validator object

func (*StringSliceDive) Validate

func (v *StringSliceDive) Validate(e *validator.Errors)

Validate applies Validator to each value in the Field.

type StringValidator

type StringValidator interface {
	Validate(*validator.Errors)
	SetField(s string)
	SetNameIndex(i int)
}

StringValidator is an interface for string validator objects.

type StringsAreEqual

type StringsAreEqual struct {
	Name            string
	Field           string
	ComparedName    string
	ComparedField   string
	CaseInsensitive bool
	Message         string
}

StringsAreEqual is a validator object. Validate adds an error if the Field is not equal to ComparedField. CaseInsensitive flag can be set to make comparison case insensitive.

func (*StringsAreEqual) SetField

func (v *StringsAreEqual) SetField(s string)

SetField sets validator field.

func (*StringsAreEqual) SetNameIndex

func (v *StringsAreEqual) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringsAreEqual) Validate

func (v *StringsAreEqual) Validate(e *validator.Errors)

Validate adds an error if the Field is not equal to ComparedField. CaseInsensitive flag can be set to make comparison case insensitive.

type StringsAreNotEqual

type StringsAreNotEqual struct {
	Name            string
	Field           string
	ComparedName    string
	ComparedField   string
	CaseInsensitive bool
	Message         string
}

StringsAreNotEqual is a validator object. Validate adds an error if the Field is equal to ComparedField. CaseInsensitive flag can be set to make comparison case insensitive.

func (*StringsAreNotEqual) SetField

func (v *StringsAreNotEqual) SetField(s string)

SetField sets validator field.

func (*StringsAreNotEqual) SetNameIndex

func (v *StringsAreNotEqual) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringsAreNotEqual) Validate

func (v *StringsAreNotEqual) Validate(e *validator.Errors)

Validate adds an error if the Field is equal to ComparedField. CaseInsensitive flag can be set to make comparison case insensitive.

type StringsArePathsInTheSameDir

type StringsArePathsInTheSameDir struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField string
	Message       string
}

StringsArePathsInTheSameDir is a validator object. Validate adds an error if paths do not share same path tree to last path element. Supplied paths are converted to absolute paths before comparison.

func (*StringsArePathsInTheSameDir) SetField

func (v *StringsArePathsInTheSameDir) SetField(s string)

SetField sets validator field.

func (*StringsArePathsInTheSameDir) SetNameIndex

func (v *StringsArePathsInTheSameDir) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringsArePathsInTheSameDir) Validate

Validate adds an error if paths do not share same path tree to last path element. Supplied paths are converted to absolute paths before comparison.

type StringsArePathsNotInTheSameDir

type StringsArePathsNotInTheSameDir struct {
	Name          string
	Field         string
	ComparedName  string
	ComparedField string
	Message       string
}

StringsArePathsNotInTheSameDir is a validator object. Validate adds an error if paths share same path tree to last path element. Supplied paths are converted to absolute paths before comparison.

func (*StringsArePathsNotInTheSameDir) SetField

func (v *StringsArePathsNotInTheSameDir) SetField(s string)

SetField sets validator field.

func (*StringsArePathsNotInTheSameDir) SetNameIndex

func (v *StringsArePathsNotInTheSameDir) SetNameIndex(i int)

SetNameIndex sets index of slice element on Name.

func (*StringsArePathsNotInTheSameDir) Validate

Validate adds an error if paths share same path tree to last path element. Supplied paths are converted to absolute paths before comparison.

type TimeIsAfterTime

type TimeIsAfterTime struct {
	Name          string
	Field         time.Time
	ComparedName  string
	ComparedField time.Time
	Message       string
}

TimeIsAfterTime is a validator object. Validate adds an error if the Field time is not after the ComparedField time.

func (*TimeIsAfterTime) Validate

func (v *TimeIsAfterTime) Validate(e *validator.Errors)

Validate adds an error if the Field time is not after the ComparedField time.

type TimeIsBeforeTime

type TimeIsBeforeTime struct {
	Name          string
	Field         time.Time
	ComparedName  string
	ComparedField time.Time
	Message       string
}

TimeIsBeforeTime is a validator object. Validate adds an error if the Field time is not before the ComparedField time.

func (*TimeIsBeforeTime) Validate

func (v *TimeIsBeforeTime) Validate(e *validator.Errors)

Validate adds an error if the Field time is not before the ComparedField time.

type TimeIsPresent

type TimeIsPresent struct {
	Name    string
	Field   time.Time
	Message string
}

TimeIsPresent is a validator object. Validate adds an error if the Field is the time default value.

func (*TimeIsPresent) Validate

func (v *TimeIsPresent) Validate(e *validator.Errors)

Validate adds an error if the Field is the time default value.

type UUIDIsPresent

type UUIDIsPresent struct {
	Name    string
	Field   uuid.UUID
	Message string
}

UUIDIsPresent is a validator object. Validate adds an error if the Field is an uuid default value (uuid.Nil).

func (*UUIDIsPresent) Validate

func (v *UUIDIsPresent) Validate(e *validator.Errors)

Validate adds an error if the Field is an uuid default value (uuid.Nil).

Source Files

Jump to

Keyboard shortcuts

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