valid

package
v2.0.26 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Formats = map[string]*regexp.Regexp{
	"alpha":               regexp.MustCompile(alphaRegexString),
	"alphaNumeric":        regexp.MustCompile(alphaNumericRegexString),
	"alphaUnicode":        regexp.MustCompile(alphaUnicodeRegexString),
	"alphaUnicodeNumeric": regexp.MustCompile(alphaUnicodeNumericRegexString),
	"numeric":             regexp.MustCompile(numericRegexString),
	"number":              regexp.MustCompile(numberRegexString),
	"email":               regexp.MustCompile(emailRegexString),
	"uuid":                regexp.MustCompile(uUIDRegexString),
	"uuid3":               regexp.MustCompile(uUID3RegexString),
	"uuid4":               regexp.MustCompile(uUID4RegexString),
	"uuid5":               regexp.MustCompile(uUID5RegexString),
	"ulid":                regexp.MustCompile(uLIDRegexString),
}
View Source
var Validators = map[string]qcode.Validator{
	"format": {
		Description: "Value must be of a format, eg: email, uuid",
		Types:       []graph.ParserType{graph.NodeLabel, graph.NodeStr},
		Type:        formatsEnum,
		NewFn:       format,
	},
	"required": {
		Description: "Variable is required",
		Types:       []graph.ParserType{graph.NodeBool},
		Type:        "Boolean",
		NewFn:       required,
	},
	"requiredIf": {
		Description: "Variable is required if another variable equals a value",
		Types:       []graph.ParserType{graph.NodeObj},
		NewFn:       requiredIf,
	},
	"requiredUnless": {
		Description: "Variable is required unless another variable equals a value",
		Types:       []graph.ParserType{graph.NodeObj},
		NewFn:       requiredUnless,
	},
	"requiredWith": {
		Description: "Variable is required if one of a list of other variables exist",
		Types:       []graph.ParserType{graph.NodeList, graph.NodeStr},
		Type:        "String",
		List:        true,
		NewFn:       requiredWith,
	},
	"requiredWithAll": {
		Description: "Variable is required if all of a list of other variables exist",
		Types:       []graph.ParserType{graph.NodeList, graph.NodeStr},
		Type:        "String",
		List:        true,
		NewFn:       requiredWithAll,
	},
	"requiredWithout": {
		Description: "Variable is required if one of a list of other variables does not exist",
		Types:       []graph.ParserType{graph.NodeList, graph.NodeStr},
		Type:        "String",
		List:        true,
		NewFn:       requiredWithout,
	},
	"requiredWithoutAll": {
		Description: "Variable is required if none of a list of other variables exist",
		Types:       []graph.ParserType{graph.NodeList, graph.NodeStr},
		Type:        "String",
		List:        true,
		NewFn:       requiredWithoutAll,
	},
	"max": {
		Description: "Maximum value a variable can be",
		Types:       []graph.ParserType{graph.NodeStr, graph.NodeNum},
		Type:        "Int",
		NewFn:       max,
	},
	"min": {
		Description: "Minimum value a variable can be",
		Types:       []graph.ParserType{graph.NodeStr, graph.NodeNum},
		Type:        "Int",
		NewFn:       min,
	},
	"equals": {
		Description: "Variable equals a value",
		Types:       []graph.ParserType{graph.NodeStr, graph.NodeNum},
		Type:        "String",
		NewFn:       equals,
	},
	"notEquals": {
		Description: "Variable does not equal a value",
		Types:       []graph.ParserType{graph.NodeStr, graph.NodeNum},
		Type:        "String",
		NewFn:       notEquals,
	},
	"oneOf": {
		Description: "Variable equals one of the following values",
		Types: []graph.ParserType{
			graph.NodeList, graph.NodeNum, graph.NodeList, graph.NodeStr,
		},
		Type:  "String",
		List:  true,
		NewFn: oneOf,
	},
	"greaterThan": {
		Description: "Variable is greater than a value",
		Types:       []graph.ParserType{graph.NodeNum},
		Type:        "Int",
		NewFn:       greaterThan,
	},
	"greaterThanOrEquals": {
		Description: "Variable is greater than or equal to a value",
		Types:       []graph.ParserType{graph.NodeStr, graph.NodeNum},
		Type:        "Int",
		NewFn:       greaterThanOrEquals,
	},
	"lessThan": {
		Description: "Variable is less than a value",
		Types:       []graph.ParserType{graph.NodeStr, graph.NodeNum},
		Type:        "Int",
		NewFn:       lessThan,
	},
	"lessThanOrEquals": {
		Description: "Variable is less than or equal to a value",
		Types:       []graph.ParserType{graph.NodeStr, graph.NodeNum},
		Type:        "Int",
		NewFn:       lessThanOrEquals,
	},
	"equalsField": {
		Description: "Variable equals the value of another variable",
		Types:       []graph.ParserType{graph.NodeStr},
		Type:        "Int",
		NewFn:       equalsField,
	},
	"notEqualsField": {
		Description: "Variable does not equal the value of another variable",
		Types:       []graph.ParserType{graph.NodeStr},
		Type:        "Int",
		NewFn:       notEqualsField,
	},
	"greaterThanField": {
		Description: "Variable is greater than the value of another variable",
		Types:       []graph.ParserType{graph.NodeStr},
		Type:        "String",
		NewFn:       greaterThanField,
	},
	"greaterThanOrEqualsField": {
		Description: "Variable is greater than or equals the value of another variable",
		Types:       []graph.ParserType{graph.NodeStr},
		Type:        "String",
		NewFn:       greaterThanOrEqualsField,
	},
	"lessThanField": {
		Description: "Variable is less than the value of another variable",
		Types:       []graph.ParserType{graph.NodeStr},
		Type:        "String",
		NewFn:       lessThanField,
	},
	"lessThanOrEqualsField": {
		Description: "Variable is less than or equals the value of another variable",
		Types:       []graph.ParserType{graph.NodeStr},
		Type:        "String",
		NewFn:       lessThanOrEqualsField,
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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