validate: github.com/gobuffalo/validate/validators Index | Files

package validators

import "github.com/gobuffalo/validate/validators"

Index

Package Files

bytes_are_present.go common.go email_is_present.go func_validator.go int_array_is_present.go int_is_greater_than.go int_is_less_than.go int_is_present.go ints_are_equal.go ints_are_not_equal.go regex_match.go string_inclusion.go string_is_present.go string_length_in_range.go strings_match.go time_after_time.go time_is_before_time.go time_is_present.go url_is_present.go uuid_is_present.go

Variables

var CustomKeys = map[string]string{}

func GenerateKey Uses

func GenerateKey(s string) string

type BytesArePresent Uses

type BytesArePresent struct {
    Name    string
    Field   []byte
    Message string
}

func (*BytesArePresent) IsValid Uses

func (v *BytesArePresent) IsValid(errors *validate.Errors)

IsValid adds an error if the field is not empty.

type EmailIsPresent Uses

type EmailIsPresent struct {
    Name    string
    Field   string
    Message string
}

func (*EmailIsPresent) IsValid Uses

func (v *EmailIsPresent) IsValid(errors *validate.Errors)

IsValid performs the validation based on the email regexp match.

type EmailLike Uses

type EmailLike struct {
    Name    string
    Field   string
    Message string
}

EmailLike checks that email has two parts (username and domain separated by @) Also it check that domain have domain zone (don`t check that zone is valid)

func (*EmailLike) IsValid Uses

func (v *EmailLike) IsValid(errors *validate.Errors)

IsValid performs the validation based on email struct (username@domain)

type FuncValidator Uses

type FuncValidator struct {
    Fn      func() bool
    Field   string
    Name    string
    Message string
}

func (*FuncValidator) IsValid Uses

func (f *FuncValidator) IsValid(verrs *validate.Errors)

type IntArrayIsPresent Uses

type IntArrayIsPresent struct {
    Name    string
    Field   []int
    Message string
}

func (*IntArrayIsPresent) IsValid Uses

func (v *IntArrayIsPresent) IsValid(errors *validate.Errors)

IsValid adds an error if the field is an empty array.

type IntIsGreaterThan Uses

type IntIsGreaterThan struct {
    Name     string
    Field    int
    Compared int
    Message  string
}

func (*IntIsGreaterThan) IsValid Uses

func (v *IntIsGreaterThan) IsValid(errors *validate.Errors)

IsValid adds an error if the field is not greater than the compared value.

type IntIsLessThan Uses

type IntIsLessThan struct {
    Name     string
    Field    int
    Compared int
    Message  string
}

func (*IntIsLessThan) IsValid Uses

func (v *IntIsLessThan) IsValid(errors *validate.Errors)

IsValid adds an error if the field is not less than the compared value.

type IntIsPresent Uses

type IntIsPresent struct {
    Name    string
    Field   int
    Message string
}

func (*IntIsPresent) IsValid Uses

func (v *IntIsPresent) IsValid(errors *validate.Errors)

IsValid adds an error if the field equals 0.

type IntsAreEqual Uses

type IntsAreEqual struct {
    ValueOne int
    ValueTwo int
    Name     string
    Message  string
}

IntsAreEqual is a validator that will compare two integers and add an error if they are not equal

func (*IntsAreEqual) IsValid Uses

func (v *IntsAreEqual) IsValid(errors *validate.Errors)

type IntsAreNotEqual Uses

type IntsAreNotEqual struct {
    ValueOne int
    ValueTwo int
    Name     string
    Message  string
}

IntsAreNotEqual is a validator that compares two integers and will add an error if they are equal

func (*IntsAreNotEqual) IsValid Uses

func (v *IntsAreNotEqual) IsValid(errors *validate.Errors)

type RegexMatch Uses

type RegexMatch struct {
    Name    string
    Field   string
    Expr    string
    Message string
}

RegexMatch specifies the properties needed by the validation.

func (*RegexMatch) IsValid Uses

func (v *RegexMatch) IsValid(errors *validate.Errors)

IsValid performs the validation based on the regexp match.

type StringInclusion Uses

type StringInclusion struct {
    Name    string
    Field   string
    List    []string
    Message string
}

func (*StringInclusion) IsValid Uses

func (v *StringInclusion) IsValid(errors *validate.Errors)

IsValid adds an error if the field is not one of the allowed values.

type StringIsPresent Uses

type StringIsPresent struct {
    Name    string
    Field   string
    Message string
}

func (*StringIsPresent) IsValid Uses

func (v *StringIsPresent) IsValid(errors *validate.Errors)

IsValid adds an error if the field is empty.

type StringLengthInRange Uses

type StringLengthInRange struct {
    Name    string
    Field   string
    Min     int
    Max     int
    Message string
}

func (*StringLengthInRange) IsValid Uses

func (v *StringLengthInRange) IsValid(errors *validate.Errors)

IsValid checks that string in range of min:max if max not present or it equal to 0 it will be equal to string length

type StringsMatch Uses

type StringsMatch struct {
    Name    string
    Field   string
    Field2  string
    Message string
}

func (*StringsMatch) IsValid Uses

func (v *StringsMatch) IsValid(errors *validate.Errors)

IsValid performs the validation equality of two strings.

type TimeAfterTime Uses

type TimeAfterTime struct {
    FirstName  string
    FirstTime  time.Time
    SecondName string
    SecondTime time.Time
    Message    string
}

func (*TimeAfterTime) IsValid Uses

func (v *TimeAfterTime) IsValid(errors *validate.Errors)

IsValid adds an error if the FirstTime is not after the SecondTime.

type TimeIsBeforeTime Uses

type TimeIsBeforeTime struct {
    FirstName  string
    FirstTime  time.Time
    SecondName string
    SecondTime time.Time
    Message    string
}

func (*TimeIsBeforeTime) IsValid Uses

func (v *TimeIsBeforeTime) IsValid(errors *validate.Errors)

IsValid adds an error if the FirstTime is after the SecondTime.

type TimeIsPresent Uses

type TimeIsPresent struct {
    Name    string
    Field   time.Time
    Message string
}

func (*TimeIsPresent) IsValid Uses

func (v *TimeIsPresent) IsValid(errors *validate.Errors)

IsValid adds an error if the field is not a valid time.

type URLIsPresent Uses

type URLIsPresent struct {
    Name    string
    Field   string
    Message string
}

func (*URLIsPresent) IsValid Uses

func (v *URLIsPresent) IsValid(errors *validate.Errors)

IsValid performs the validation to check if URL is formatted correctly uses net/url ParseRequestURI to check validity

type UUIDIsPresent Uses

type UUIDIsPresent struct {
    Name    string
    Field   uuid.UUID
    Message string
}

func (*UUIDIsPresent) IsValid Uses

func (v *UUIDIsPresent) IsValid(errors *validate.Errors)

IsValid adds an error if the field is not a valid uuid.

Package validators imports 9 packages (graph) and is imported by 16 packages. Updated 2018-11-10. Refresh now. Tools for package owners.