validations

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 14 Imported by: 0

README

validations

Documentation

Index

Constants

View Source
const (
	STR         = "Case-sensitive string"
	IP          = "IP"
	EMAIL       = "Email"
	FQDN        = "FQDN"
	INTEGER     = "Integer"
	CIDR        = "CIDR"
	CITY        = "City"
	COUNTRY     = "Country"
	FLOAT       = "Float"
	URL         = "URL"
	MD5         = "MD5"
	HEXADECIMAL = "Hexadecimal"
	BASE64      = "BASE64"
	DATE        = "Date"
	MAC         = "MAC"
	MIME        = "MIME type"
	PHONE       = "Phone"
	SHA1        = "SHA-1"
	SHA224      = "SHA-224"
	SHA256      = "SHA-256"
	SHA384      = "SHA-384"
	SHA512      = "SHA-512"
	SHA3_224    = "SHA3-224"
	SHA3_256    = "SHA3-256"
	SHA3_384    = "SHA3-384"
	SHA3_512    = "SHA3-512"
	SHA512_224  = "SHA512-224"
	SHA512_256  = "SHA512-256"
	DATETIME    = "Datetime"
	UUID        = "UUID"
	BOOLEAN     = "Boolean"
	ISTR        = "String"
	PATH        = "Path"
	OBJECT      = "UUID|MD5|SHA3-256"
	ADVERSARY   = "Adversary"
	REGEX       = "Regex"
)

Variables

View Source
var Definitions = []Definition{}/* 132 elements not displayed */

Functions

func GenerateSHA3256

func GenerateSHA3256(value string) string

func ValidateAdversary added in v1.3.3

func ValidateAdversary(value interface{}) (string, string, error)

func ValidateBase64

func ValidateBase64(value interface{}) (string, string, error)

func ValidateBoolean

func ValidateBoolean(value interface{}) (bool, string, error)

func ValidateCIDR

func ValidateCIDR(value interface{}) (string, string, error)

func ValidateCity

func ValidateCity(value interface{}) (string, string, error)

func ValidateCountry

func ValidateCountry(value interface{}) (string, string, error)

func ValidateDate

func ValidateDate(value interface{}) (string, string, error)

func ValidateDatetime

func ValidateDatetime(value interface{}) (string, string, error)

func ValidateEmail

func ValidateEmail(value interface{}) (string, string, error)

func ValidateFQDN added in v1.3.6

func ValidateFQDN(value interface{}) (string, string, error)

func ValidateFloat

func ValidateFloat(value interface{}) (float64, string, error)

func ValidateHexadecimal

func ValidateHexadecimal(value interface{}) (string, string, error)

func ValidateIP

func ValidateIP(value interface{}) (string, string, error)

func ValidateInteger

func ValidateInteger(value interface{}) (int64, string, error)

func ValidateMAC

func ValidateMAC(value interface{}) (string, string, error)

func ValidateMD5

func ValidateMD5(value interface{}) (string, string, error)

func ValidateMime

func ValidateMime(value interface{}) (string, string, error)

func ValidateObject added in v1.3.3

func ValidateObject(value interface{}) (string, string, error)

func ValidatePath added in v1.3.3

func ValidatePath(value interface{}) (string, string, error)

func ValidatePhone

func ValidatePhone(value interface{}) (string, string, error)

func ValidateRegEx

func ValidateRegEx(regex, value string) error

func ValidateRegexComp added in v1.4.2

func ValidateRegexComp(value interface{}) (string, string, error)

func ValidateSHA1

func ValidateSHA1(value interface{}) (string, string, error)

func ValidateSHA224

func ValidateSHA224(value interface{}) (string, string, error)

func ValidateSHA256

func ValidateSHA256(value interface{}) (string, string, error)

func ValidateSHA3224

func ValidateSHA3224(value interface{}) (string, string, error)

func ValidateSHA3256

func ValidateSHA3256(value interface{}) (string, string, error)

func ValidateSHA3384

func ValidateSHA3384(value interface{}) (string, string, error)

func ValidateSHA3512

func ValidateSHA3512(value interface{}) (string, string, error)

func ValidateSHA384

func ValidateSHA384(value interface{}) (string, string, error)

func ValidateSHA512

func ValidateSHA512(value interface{}) (string, string, error)

func ValidateSHA512224

func ValidateSHA512224(value interface{}) (string, string, error)

func ValidateSHA512256

func ValidateSHA512256(value interface{}) (string, string, error)

func ValidateString

func ValidateString(value interface{}, insensitive bool) (string, string, error)

func ValidateURL

func ValidateURL(value interface{}) (string, string, error)

func ValidateUUID

func ValidateUUID(value interface{}) (uuid.UUID, string, error)

func ValidateValue

func ValidateValue(value interface{}, t string) (interface{}, string, error)

Types

type Definition added in v1.2.0

type Definition struct {
	Type         string       `json:"type" example:"object"`
	Description  string       `json:"description" example:"Important description about the type"`
	DataType     string       `json:"dataType" example:"String"`
	Example      *Entity      `json:"example,omitempty"`
	Attributes   []Definition `json:"attributes,omitempty"`
	Associations []Definition `json:"associations,omitempty"`
	Tags         []string     `json:"tags,omitempty"`
	Correlate    []string     `json:"correlate,omitempty"`
	Label        string       `json:"label,omitempty"`
}

type Entity added in v1.3.1

type Entity struct {
	Type         string                 `json:"type"  example:"object"`
	Attributes   map[string]interface{} `json:"attributes"`
	Associations []Entity               `json:"associations"`
	Reputation   int                    `json:"reputation" example:"-1"`
	Correlate    []string               `json:"correlate"`
	Tags         []string               `json:"tags"`
	VisibleBy    []string               `json:"visibleBy"`
}

Jump to

Keyboard shortcuts

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