Documentation ¶
Index ¶
- Constants
- func Asset(name string) ([]byte, error)
- func AssetDigest(name string) ([sha256.Size]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func AssetString(name string) (string, error)
- func Digests() (map[string][sha256.Size]byte, error)
- func MustAsset(name string) []byte
- func MustAssetString(name string) string
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type TestData
- type TypedList
- type ValidateIsRule
- type ValidateProject
- type ValidateProperty
- type ValidateRule
- type ValidateStruct
Constants ¶
const AssetDebug = false
AssetDebug is true if the assets were built with the debug flag enabled.
const OZZO_VALIDATOR_TEMPLATE string = "templates/ozzo-validator.tmpl"
const OZZO_VALIDATOR_TEST_TEMPLATE string = "templates/ozzo-validator-test.tmpl"
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDigest ¶
AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"}, AssetDir("data/img") would return []string{"a.png", "b.png"}, AssetDir("foo.txt") and AssetDir("notexist") would return an error, and AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetString ¶
AssetString returns the asset contents as a string (instead of a []byte).
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func MustAssetString ¶
MustAssetString is like AssetString but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory.
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively.
Types ¶
type ValidateIsRule ¶
type ValidateIsRule struct { Email bool EmailFormat bool URL bool RequestURL bool RequestURI bool Alpha bool Digit bool Alphanumeric bool UTFLetter bool UTFDigit bool UTFLetterNumeric bool UTFNumeric bool LowerCase bool UpperCase bool Hexadecimal bool HexColor bool RGBColor bool Int bool Float bool UUIDv3 bool UUIDv4 bool UUIDv5 bool UUID bool CreditCard bool ISBN10 bool ISBN13 bool ISBN bool JSON bool ASCII bool PrintableASCII bool Multibyte bool FullWidth bool HalfWidth bool VariableWidth bool Base64 bool DataURI bool E164 bool CountryCode2 bool CountryCode3 bool DialString bool MAC bool IP bool IPv4 bool IPv6 bool Subdomain bool Domain bool DNSName bool Host bool Port bool MongoID bool Latitude bool Longitude bool SSN bool Semver bool }
type ValidateProject ¶
type ValidateProject struct { Type string MethodName string Template string TemplateTest string ForTest bool Validators map[string]ValidateStruct }
Project information to generate validators. Generated from Validator Toml
func ParseToml ¶
func ParseToml(tomlPath string) (*ValidateProject, error)
ParseToml parses the Toml file and generate ValidatorProject
func (*ValidateProject) Generate ¶
func (vp *ValidateProject) Generate() error
Generate validators defined in ValidatorProject.Validators in the specified directory
func (*ValidateProject) GenerateWithTemplate ¶
func (vp *ValidateProject) GenerateWithTemplate(template_path string) error
func (ValidateProject) Validate ¶
func (vp ValidateProject) Validate() error
type ValidateProperty ¶
type ValidateProperty struct { Name string Type string ValidateRule }
Validator settings to apply to a field
func (ValidateProperty) Validate ¶
func (vp ValidateProperty) Validate() error
type ValidateRule ¶
type ValidateRule struct { In TypedList NotIn TypedList Length []int RuneLength []int Match string Date string Required bool NotNil bool Nil bool NilOrNotEmpty bool Empty bool MultipleOf []TypedList Each []ValidateRule // When TODO Else []ValidateRule ValidateIsRule }
type ValidateStruct ¶
type ValidateStruct struct { Package string Name string Receiver string Dir string FileName string FileMode int Import []string MethodName string Properties map[string]ValidateProperty TestData TestData }
Information on the struct that generates the validator and the validator go codes
func (ValidateStruct) Validate ¶
func (vs ValidateStruct) Validate() error