kube-openapik8s.io/kube-openapi/pkg/internal/third_party/govalidator Index | Files

package govalidator

import "k8s.io/kube-openapi/pkg/internal/third_party/govalidator"

Package govalidator is package of validators and sanitizers for strings, structs and collections.

Index

Constants

const (
	CreditCard string = "" /* 153 byte string literal not displayed */
	ISBN10     string = "^(?:[0-9]{9}X|[0-9]{10})$"
	ISBN13     string = "^(?:[0-9]{13})$"
	Hexcolor   string = "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
	RGBcolor   string = "" /* 159 byte string literal not displayed */
	Base64     string = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$"
	SSN        string = `^\d{3}[- ]?\d{2}[- ]?\d{4}$`
	Int        string = "^(?:[-+]?(?:0|[1-9][0-9]*))$"
)

Basic regular expressions for validating strings

Functions

func IsBase64

func IsBase64(str string) bool

IsBase64 check if a string is base64 encoded.

func IsCreditCard

func IsCreditCard(str string) bool

IsCreditCard check if the string is a credit card.

func IsHexcolor

func IsHexcolor(str string) bool

IsHexcolor check if the string is a hexadecimal color.

func IsIPv6

func IsIPv6(str string) bool

IsIPv6 check if the string is an IP version 6.

func IsISBN

func IsISBN(str string, version int) bool

IsISBN check if the string is an ISBN (version 10 or 13). If version value is not equal to 10 or 13, it will be check both variants.

func IsISBN10

func IsISBN10(str string) bool

IsISBN10 check if the string is an ISBN version 10.

func IsISBN13

func IsISBN13(str string) bool

IsISBN13 check if the string is an ISBN version 13.

func IsInt

func IsInt(str string) bool

IsInt check if the string is an integer. Empty string is valid.

func IsMAC

func IsMAC(str string) bool

IsMAC check if a string is valid MAC address. Possible MAC formats: 01:23:45:67:89:ab 01:23:45:67:89:ab:cd:ef 01-23-45-67-89-ab 01-23-45-67-89-ab-cd-ef 0123.4567.89ab 0123.4567.89ab.cdef

func IsNull

func IsNull(str string) bool

IsNull check if the string is null.

func IsRGBcolor

func IsRGBcolor(str string) bool

IsRGBcolor check if the string is a valid RGB color in form rgb(RRR, GGG, BBB).

func IsRequestURI

func IsRequestURI(rawurl string) bool

IsRequestURI check if the string rawurl, assuming it was received in an HTTP request, is an absolute URI or an absolute path.

func IsSSN

func IsSSN(str string) bool

IsSSN will validate the given string as a U.S. Social Security Number

func ToInt

func ToInt(value interface{}) (res int64, err error)

ToInt convert the input string or any int type to an integer type 64, or 0 if the input is not an integer.

Source Files

patterns.go validator.go

Version
v0.0.0-20250318190949-c8a335a9a2ff (latest)
Published
Mar 18, 2025
Platform
js/wasm
Imports
7 packages
Last checked
1 month ago

Tools for package owners.