Пример #1
0
func init() {
	u := URI("")
	Default.Add("uri", &u, IsStrictURI)

	eml := Email("")
	Default.Add("email", &eml, govalidator.IsEmail)

	hn := Hostname("")
	Default.Add("hostname", &hn, IsHostname)

	ip4 := IPv4("")
	Default.Add("ipv4", &ip4, govalidator.IsIPv4)

	ip6 := IPv6("")
	Default.Add("ipv6", &ip6, govalidator.IsIPv6)

	mac := MAC("")
	Default.Add("mac", &mac, govalidator.IsMAC)

	uid := UUID("")
	Default.Add("uuid", &uid, govalidator.IsUUID)

	uid3 := UUID3("")
	Default.Add("uuid3", &uid3, govalidator.IsUUIDv3)

	uid4 := UUID4("")
	Default.Add("uuid4", &uid4, govalidator.IsUUIDv4)

	uid5 := UUID5("")
	Default.Add("uuid5", &uid5, govalidator.IsUUIDv5)

	isbn := ISBN("")
	Default.Add("isbn", &isbn, func(str string) bool { return govalidator.IsISBN10(str) || govalidator.IsISBN13(str) })

	isbn10 := ISBN10("")
	Default.Add("isbn10", &isbn10, govalidator.IsISBN10)

	isbn13 := ISBN13("")
	Default.Add("isbn13", &isbn13, govalidator.IsISBN13)

	cc := CreditCard("")
	Default.Add("creditcard", &cc, govalidator.IsCreditCard)

	ssn := SSN("")
	Default.Add("ssn", &ssn, govalidator.IsSSN)

	hc := HexColor("")
	Default.Add("hexcolor", &hc, govalidator.IsHexcolor)

	rc := RGBColor("")
	Default.Add("rgbcolor", &rc, govalidator.IsRGBcolor)

	b64 := Base64([]byte(nil))
	Default.Add("byte", &b64, govalidator.IsBase64)

	pw := Password("")
	Default.Add("password", &pw, func(_ string) bool { return true })
}
Пример #2
0
func (i IsISBN10Checker) IsFormat(data string) bool {
	return govalidator.IsISBN10(data)
}