validators

package
v13.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Overview

Package validators provides basic KNF validators

Index

Constants

This section is empty.

Variables

View Source
var (
	// Empty returns error if property is not set
	Set = validatorSet

	// SetToAny returns error if property doesn't contain any value from given slice
	SetToAny = validatorSetToAny

	// SetToAnyIgnoreCase returns error if property doesn't contain value from given
	// slice in any letter case
	SetToAnyIgnoreCase = validatorSetToAnyIgnoreCase

	// Less returns an error if the property value is smaller than the given number
	Less = validatorLess

	// Greater returns an error if the property value is greater than the given number
	Greater = validatorGreater

	// InRange returns an error if the property value is not in the given range
	InRange = validatorInRange

	// NotEquals returns an error if the property value is equal to the given string
	NotEquals = validatorNotEquals

	// LenLess returns an error if the length of the property value is greater than
	// given number
	LenLess = validatorLenLess

	// LenGreater returns an error if the length of the property value is less than
	// given number
	LenGreater = validatorLenGreater

	// LenNotEquals an error if the length of the property value is not equal to the
	// given number
	LenEquals = validatorLenEquals

	// HasPrefix returns error if property doesn't have given prefix
	HasPrefix = validatorHasPrefix

	// HasSuffix returns error if property doesn't have given suffix
	HasSuffix = validatorHasSuffix

	// SizeLess returns an error if the property value is smaller than the given number
	SizeLess = validatorSizeLess

	// SizeGreater returns an error if the property value is greater than the given number
	SizeGreater = validatorSizeGreater

	// TypeBool returns error if property contains non-boolean value
	TypeBool = validatorTypeBool

	// TypeNum returns error if property contains non-numeric (int/uint) value
	TypeNum = validatorTypeNum

	// TypeNum returns error if property contains non-float value
	TypeFloat = validatorTypeFloat

	// TypeSize returns error if property contains non-size value
	TypeSize = validatorTypeSize
)

Functions

This section is empty.

Types

type Range added in v13.7.0

type Range struct {
	From any
	To   any
}

Range is numeric range

Directories

Path Synopsis
Package fs provides KNF validators for checking file-system items
Package fs provides KNF validators for checking file-system items
Package network provides KNF validators for checking items related to network
Package network provides KNF validators for checking items related to network
Package regexp provides KNF validators with regular expressions
Package regexp provides KNF validators with regular expressions
Package system provides KNF validators for checking system items (user, groups, network interfaces)
Package system provides KNF validators for checking system items (user, groups, network interfaces)

Jump to

Keyboard shortcuts

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