Documentation ¶
Overview ¶
Valgo is a type-safe, expressive, and extensible validator library for Golang. Valgo is built with generics, so Go 1.18 or higher is required.
Valgo differs from other Golang validation libraries in that the rules are written in functions and not in struct tags. This allows greater flexibility and freedom when it comes to where and how data is validated.
Additionally, Valgo supports customizing and localizing validation messages.
Code generated by Valgo; DO NOT EDIT.
Code generated by Valgo; DO NOT EDIT.
Code generated by Valgo; DO NOT EDIT.
Code generated by Valgo; DO NOT EDIT.
Example ¶
val := Is(String("Bob", "full_name").Not().Blank().OfLengthBetween(4, 20)). Is(Number(17, "age").GreaterThan(18)) if !val.Valid() { out, _ := json.MarshalIndent(val.Error(), "", " ") fmt.Println(string(out)) }
Output: { "age": [ "Age must be greater than \"18\"" ], "full_name": [ "Full name must have a length between \"4\" and \"20\"" ] }
Index ¶
- Constants
- func TestValidatorByteBetweenInvalid(t *testing.T)
- func TestValidatorByteBetweenValid(t *testing.T)
- func TestValidatorByteEqualToInvalid(t *testing.T)
- func TestValidatorByteEqualToValid(t *testing.T)
- func TestValidatorByteGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorByteGreaterOrEqualToValid(t *testing.T)
- func TestValidatorByteGreaterThanInvalid(t *testing.T)
- func TestValidatorByteGreaterThanValid(t *testing.T)
- func TestValidatorByteInSliceInvalid(t *testing.T)
- func TestValidatorByteInSliceValid(t *testing.T)
- func TestValidatorByteLessOrEqualToInvalid(t *testing.T)
- func TestValidatorByteLessOrEqualToValid(t *testing.T)
- func TestValidatorByteLessThanInvalid(t *testing.T)
- func TestValidatorByteLessThanValid(t *testing.T)
- func TestValidatorByteNot(t *testing.T)
- func TestValidatorBytePBetweenInvalid(t *testing.T)
- func TestValidatorBytePBetweenValid(t *testing.T)
- func TestValidatorBytePEqualToInvalid(t *testing.T)
- func TestValidatorBytePEqualToValid(t *testing.T)
- func TestValidatorBytePGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorBytePGreaterOrEqualToValid(t *testing.T)
- func TestValidatorBytePGreaterThanInvalid(t *testing.T)
- func TestValidatorBytePGreaterThanValid(t *testing.T)
- func TestValidatorBytePInSliceInvalid(t *testing.T)
- func TestValidatorBytePInSliceValid(t *testing.T)
- func TestValidatorBytePLessOrEqualToInvalid(t *testing.T)
- func TestValidatorBytePLessOrEqualToValid(t *testing.T)
- func TestValidatorBytePLessThanInvalid(t *testing.T)
- func TestValidatorBytePLessThanValid(t *testing.T)
- func TestValidatorBytePNilIsInvalid(t *testing.T)
- func TestValidatorBytePNilIsValid(t *testing.T)
- func TestValidatorBytePNot(t *testing.T)
- func TestValidatorBytePPassingInvalid(t *testing.T)
- func TestValidatorBytePPassingValid(t *testing.T)
- func TestValidatorBytePZeroInvalid(t *testing.T)
- func TestValidatorBytePZeroOrNilInvalid(t *testing.T)
- func TestValidatorBytePZeroOrNilValid(t *testing.T)
- func TestValidatorBytePZeroValid(t *testing.T)
- func TestValidatorBytePassingInvalid(t *testing.T)
- func TestValidatorBytePassingValid(t *testing.T)
- func TestValidatorByteZeroInvalid(t *testing.T)
- func TestValidatorByteZeroValid(t *testing.T)
- func TestValidatorFloat32BetweenInvalid(t *testing.T)
- func TestValidatorFloat32BetweenValid(t *testing.T)
- func TestValidatorFloat32EqualToInvalid(t *testing.T)
- func TestValidatorFloat32EqualToValid(t *testing.T)
- func TestValidatorFloat32GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorFloat32GreaterOrEqualToValid(t *testing.T)
- func TestValidatorFloat32GreaterThanInvalid(t *testing.T)
- func TestValidatorFloat32GreaterThanValid(t *testing.T)
- func TestValidatorFloat32InSliceInvalid(t *testing.T)
- func TestValidatorFloat32InSliceValid(t *testing.T)
- func TestValidatorFloat32LessOrEqualToInvalid(t *testing.T)
- func TestValidatorFloat32LessOrEqualToValid(t *testing.T)
- func TestValidatorFloat32LessThanInvalid(t *testing.T)
- func TestValidatorFloat32LessThanValid(t *testing.T)
- func TestValidatorFloat32Not(t *testing.T)
- func TestValidatorFloat32PBetweenInvalid(t *testing.T)
- func TestValidatorFloat32PBetweenValid(t *testing.T)
- func TestValidatorFloat32PEqualToInvalid(t *testing.T)
- func TestValidatorFloat32PEqualToValid(t *testing.T)
- func TestValidatorFloat32PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorFloat32PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorFloat32PGreaterThanInvalid(t *testing.T)
- func TestValidatorFloat32PGreaterThanValid(t *testing.T)
- func TestValidatorFloat32PInSliceInvalid(t *testing.T)
- func TestValidatorFloat32PInSliceValid(t *testing.T)
- func TestValidatorFloat32PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorFloat32PLessOrEqualToValid(t *testing.T)
- func TestValidatorFloat32PLessThanInvalid(t *testing.T)
- func TestValidatorFloat32PLessThanValid(t *testing.T)
- func TestValidatorFloat32PNilIsInvalid(t *testing.T)
- func TestValidatorFloat32PNilIsValid(t *testing.T)
- func TestValidatorFloat32PNot(t *testing.T)
- func TestValidatorFloat32PPassingInvalid(t *testing.T)
- func TestValidatorFloat32PPassingValid(t *testing.T)
- func TestValidatorFloat32PZeroInvalid(t *testing.T)
- func TestValidatorFloat32PZeroOrNilInvalid(t *testing.T)
- func TestValidatorFloat32PZeroOrNilValid(t *testing.T)
- func TestValidatorFloat32PZeroValid(t *testing.T)
- func TestValidatorFloat32PassingInvalid(t *testing.T)
- func TestValidatorFloat32PassingValid(t *testing.T)
- func TestValidatorFloat32ZeroInvalid(t *testing.T)
- func TestValidatorFloat32ZeroValid(t *testing.T)
- func TestValidatorFloat64BetweenInvalid(t *testing.T)
- func TestValidatorFloat64BetweenValid(t *testing.T)
- func TestValidatorFloat64EqualToInvalid(t *testing.T)
- func TestValidatorFloat64EqualToValid(t *testing.T)
- func TestValidatorFloat64GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorFloat64GreaterOrEqualToValid(t *testing.T)
- func TestValidatorFloat64GreaterThanInvalid(t *testing.T)
- func TestValidatorFloat64GreaterThanValid(t *testing.T)
- func TestValidatorFloat64InSliceInvalid(t *testing.T)
- func TestValidatorFloat64InSliceValid(t *testing.T)
- func TestValidatorFloat64LessOrEqualToInvalid(t *testing.T)
- func TestValidatorFloat64LessOrEqualToValid(t *testing.T)
- func TestValidatorFloat64LessThanInvalid(t *testing.T)
- func TestValidatorFloat64LessThanValid(t *testing.T)
- func TestValidatorFloat64Not(t *testing.T)
- func TestValidatorFloat64PBetweenInvalid(t *testing.T)
- func TestValidatorFloat64PBetweenValid(t *testing.T)
- func TestValidatorFloat64PEqualToInvalid(t *testing.T)
- func TestValidatorFloat64PEqualToValid(t *testing.T)
- func TestValidatorFloat64PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorFloat64PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorFloat64PGreaterThanInvalid(t *testing.T)
- func TestValidatorFloat64PGreaterThanValid(t *testing.T)
- func TestValidatorFloat64PInSliceInvalid(t *testing.T)
- func TestValidatorFloat64PInSliceValid(t *testing.T)
- func TestValidatorFloat64PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorFloat64PLessOrEqualToValid(t *testing.T)
- func TestValidatorFloat64PLessThanInvalid(t *testing.T)
- func TestValidatorFloat64PLessThanValid(t *testing.T)
- func TestValidatorFloat64PNilIsInvalid(t *testing.T)
- func TestValidatorFloat64PNilIsValid(t *testing.T)
- func TestValidatorFloat64PNot(t *testing.T)
- func TestValidatorFloat64PPassingInvalid(t *testing.T)
- func TestValidatorFloat64PPassingValid(t *testing.T)
- func TestValidatorFloat64PZeroInvalid(t *testing.T)
- func TestValidatorFloat64PZeroOrNilInvalid(t *testing.T)
- func TestValidatorFloat64PZeroOrNilValid(t *testing.T)
- func TestValidatorFloat64PZeroValid(t *testing.T)
- func TestValidatorFloat64PassingInvalid(t *testing.T)
- func TestValidatorFloat64PassingValid(t *testing.T)
- func TestValidatorFloat64ZeroInvalid(t *testing.T)
- func TestValidatorFloat64ZeroValid(t *testing.T)
- func TestValidatorInt16BetweenInvalid(t *testing.T)
- func TestValidatorInt16BetweenValid(t *testing.T)
- func TestValidatorInt16EqualToInvalid(t *testing.T)
- func TestValidatorInt16EqualToValid(t *testing.T)
- func TestValidatorInt16GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorInt16GreaterOrEqualToValid(t *testing.T)
- func TestValidatorInt16GreaterThanInvalid(t *testing.T)
- func TestValidatorInt16GreaterThanValid(t *testing.T)
- func TestValidatorInt16InSliceInvalid(t *testing.T)
- func TestValidatorInt16InSliceValid(t *testing.T)
- func TestValidatorInt16LessOrEqualToInvalid(t *testing.T)
- func TestValidatorInt16LessOrEqualToValid(t *testing.T)
- func TestValidatorInt16LessThanInvalid(t *testing.T)
- func TestValidatorInt16LessThanValid(t *testing.T)
- func TestValidatorInt16Not(t *testing.T)
- func TestValidatorInt16PBetweenInvalid(t *testing.T)
- func TestValidatorInt16PBetweenValid(t *testing.T)
- func TestValidatorInt16PEqualToInvalid(t *testing.T)
- func TestValidatorInt16PEqualToValid(t *testing.T)
- func TestValidatorInt16PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorInt16PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorInt16PGreaterThanInvalid(t *testing.T)
- func TestValidatorInt16PGreaterThanValid(t *testing.T)
- func TestValidatorInt16PInSliceInvalid(t *testing.T)
- func TestValidatorInt16PInSliceValid(t *testing.T)
- func TestValidatorInt16PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorInt16PLessOrEqualToValid(t *testing.T)
- func TestValidatorInt16PLessThanInvalid(t *testing.T)
- func TestValidatorInt16PLessThanValid(t *testing.T)
- func TestValidatorInt16PNilIsInvalid(t *testing.T)
- func TestValidatorInt16PNilIsValid(t *testing.T)
- func TestValidatorInt16PNot(t *testing.T)
- func TestValidatorInt16PPassingInvalid(t *testing.T)
- func TestValidatorInt16PPassingValid(t *testing.T)
- func TestValidatorInt16PZeroInvalid(t *testing.T)
- func TestValidatorInt16PZeroOrNilInvalid(t *testing.T)
- func TestValidatorInt16PZeroOrNilValid(t *testing.T)
- func TestValidatorInt16PZeroValid(t *testing.T)
- func TestValidatorInt16PassingInvalid(t *testing.T)
- func TestValidatorInt16PassingValid(t *testing.T)
- func TestValidatorInt16ZeroInvalid(t *testing.T)
- func TestValidatorInt16ZeroValid(t *testing.T)
- func TestValidatorInt32BetweenInvalid(t *testing.T)
- func TestValidatorInt32BetweenValid(t *testing.T)
- func TestValidatorInt32EqualToInvalid(t *testing.T)
- func TestValidatorInt32EqualToValid(t *testing.T)
- func TestValidatorInt32GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorInt32GreaterOrEqualToValid(t *testing.T)
- func TestValidatorInt32GreaterThanInvalid(t *testing.T)
- func TestValidatorInt32GreaterThanValid(t *testing.T)
- func TestValidatorInt32InSliceInvalid(t *testing.T)
- func TestValidatorInt32InSliceValid(t *testing.T)
- func TestValidatorInt32LessOrEqualToInvalid(t *testing.T)
- func TestValidatorInt32LessOrEqualToValid(t *testing.T)
- func TestValidatorInt32LessThanInvalid(t *testing.T)
- func TestValidatorInt32LessThanValid(t *testing.T)
- func TestValidatorInt32Not(t *testing.T)
- func TestValidatorInt32PBetweenInvalid(t *testing.T)
- func TestValidatorInt32PBetweenValid(t *testing.T)
- func TestValidatorInt32PEqualToInvalid(t *testing.T)
- func TestValidatorInt32PEqualToValid(t *testing.T)
- func TestValidatorInt32PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorInt32PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorInt32PGreaterThanInvalid(t *testing.T)
- func TestValidatorInt32PGreaterThanValid(t *testing.T)
- func TestValidatorInt32PInSliceInvalid(t *testing.T)
- func TestValidatorInt32PInSliceValid(t *testing.T)
- func TestValidatorInt32PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorInt32PLessOrEqualToValid(t *testing.T)
- func TestValidatorInt32PLessThanInvalid(t *testing.T)
- func TestValidatorInt32PLessThanValid(t *testing.T)
- func TestValidatorInt32PNilIsInvalid(t *testing.T)
- func TestValidatorInt32PNilIsValid(t *testing.T)
- func TestValidatorInt32PNot(t *testing.T)
- func TestValidatorInt32PPassingInvalid(t *testing.T)
- func TestValidatorInt32PPassingValid(t *testing.T)
- func TestValidatorInt32PZeroInvalid(t *testing.T)
- func TestValidatorInt32PZeroOrNilInvalid(t *testing.T)
- func TestValidatorInt32PZeroOrNilValid(t *testing.T)
- func TestValidatorInt32PZeroValid(t *testing.T)
- func TestValidatorInt32PassingInvalid(t *testing.T)
- func TestValidatorInt32PassingValid(t *testing.T)
- func TestValidatorInt32ZeroInvalid(t *testing.T)
- func TestValidatorInt32ZeroValid(t *testing.T)
- func TestValidatorInt64BetweenInvalid(t *testing.T)
- func TestValidatorInt64BetweenValid(t *testing.T)
- func TestValidatorInt64EqualToInvalid(t *testing.T)
- func TestValidatorInt64EqualToValid(t *testing.T)
- func TestValidatorInt64GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorInt64GreaterOrEqualToValid(t *testing.T)
- func TestValidatorInt64GreaterThanInvalid(t *testing.T)
- func TestValidatorInt64GreaterThanValid(t *testing.T)
- func TestValidatorInt64InSliceInvalid(t *testing.T)
- func TestValidatorInt64InSliceValid(t *testing.T)
- func TestValidatorInt64LessOrEqualToInvalid(t *testing.T)
- func TestValidatorInt64LessOrEqualToValid(t *testing.T)
- func TestValidatorInt64LessThanInvalid(t *testing.T)
- func TestValidatorInt64LessThanValid(t *testing.T)
- func TestValidatorInt64Not(t *testing.T)
- func TestValidatorInt64PBetweenInvalid(t *testing.T)
- func TestValidatorInt64PBetweenValid(t *testing.T)
- func TestValidatorInt64PEqualToInvalid(t *testing.T)
- func TestValidatorInt64PEqualToValid(t *testing.T)
- func TestValidatorInt64PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorInt64PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorInt64PGreaterThanInvalid(t *testing.T)
- func TestValidatorInt64PGreaterThanValid(t *testing.T)
- func TestValidatorInt64PInSliceInvalid(t *testing.T)
- func TestValidatorInt64PInSliceValid(t *testing.T)
- func TestValidatorInt64PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorInt64PLessOrEqualToValid(t *testing.T)
- func TestValidatorInt64PLessThanInvalid(t *testing.T)
- func TestValidatorInt64PLessThanValid(t *testing.T)
- func TestValidatorInt64PNilIsInvalid(t *testing.T)
- func TestValidatorInt64PNilIsValid(t *testing.T)
- func TestValidatorInt64PNot(t *testing.T)
- func TestValidatorInt64PPassingInvalid(t *testing.T)
- func TestValidatorInt64PPassingValid(t *testing.T)
- func TestValidatorInt64PZeroInvalid(t *testing.T)
- func TestValidatorInt64PZeroOrNilInvalid(t *testing.T)
- func TestValidatorInt64PZeroOrNilValid(t *testing.T)
- func TestValidatorInt64PZeroValid(t *testing.T)
- func TestValidatorInt64PassingInvalid(t *testing.T)
- func TestValidatorInt64PassingValid(t *testing.T)
- func TestValidatorInt64ZeroInvalid(t *testing.T)
- func TestValidatorInt64ZeroValid(t *testing.T)
- func TestValidatorInt8BetweenInvalid(t *testing.T)
- func TestValidatorInt8BetweenValid(t *testing.T)
- func TestValidatorInt8EqualToInvalid(t *testing.T)
- func TestValidatorInt8EqualToValid(t *testing.T)
- func TestValidatorInt8GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorInt8GreaterOrEqualToValid(t *testing.T)
- func TestValidatorInt8GreaterThanInvalid(t *testing.T)
- func TestValidatorInt8GreaterThanValid(t *testing.T)
- func TestValidatorInt8InSliceInvalid(t *testing.T)
- func TestValidatorInt8InSliceValid(t *testing.T)
- func TestValidatorInt8LessOrEqualToInvalid(t *testing.T)
- func TestValidatorInt8LessOrEqualToValid(t *testing.T)
- func TestValidatorInt8LessThanInvalid(t *testing.T)
- func TestValidatorInt8LessThanValid(t *testing.T)
- func TestValidatorInt8Not(t *testing.T)
- func TestValidatorInt8PBetweenInvalid(t *testing.T)
- func TestValidatorInt8PBetweenValid(t *testing.T)
- func TestValidatorInt8PEqualToInvalid(t *testing.T)
- func TestValidatorInt8PEqualToValid(t *testing.T)
- func TestValidatorInt8PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorInt8PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorInt8PGreaterThanInvalid(t *testing.T)
- func TestValidatorInt8PGreaterThanValid(t *testing.T)
- func TestValidatorInt8PInSliceInvalid(t *testing.T)
- func TestValidatorInt8PInSliceValid(t *testing.T)
- func TestValidatorInt8PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorInt8PLessOrEqualToValid(t *testing.T)
- func TestValidatorInt8PLessThanInvalid(t *testing.T)
- func TestValidatorInt8PLessThanValid(t *testing.T)
- func TestValidatorInt8PNilIsInvalid(t *testing.T)
- func TestValidatorInt8PNilIsValid(t *testing.T)
- func TestValidatorInt8PNot(t *testing.T)
- func TestValidatorInt8PPassingInvalid(t *testing.T)
- func TestValidatorInt8PPassingValid(t *testing.T)
- func TestValidatorInt8PZeroInvalid(t *testing.T)
- func TestValidatorInt8PZeroOrNilInvalid(t *testing.T)
- func TestValidatorInt8PZeroOrNilValid(t *testing.T)
- func TestValidatorInt8PZeroValid(t *testing.T)
- func TestValidatorInt8PassingInvalid(t *testing.T)
- func TestValidatorInt8PassingValid(t *testing.T)
- func TestValidatorInt8ZeroInvalid(t *testing.T)
- func TestValidatorInt8ZeroValid(t *testing.T)
- func TestValidatorIntBetweenInvalid(t *testing.T)
- func TestValidatorIntBetweenValid(t *testing.T)
- func TestValidatorIntEqualToInvalid(t *testing.T)
- func TestValidatorIntEqualToValid(t *testing.T)
- func TestValidatorIntGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorIntGreaterOrEqualToValid(t *testing.T)
- func TestValidatorIntGreaterThanInvalid(t *testing.T)
- func TestValidatorIntGreaterThanValid(t *testing.T)
- func TestValidatorIntInSliceInvalid(t *testing.T)
- func TestValidatorIntInSliceValid(t *testing.T)
- func TestValidatorIntLessOrEqualToInvalid(t *testing.T)
- func TestValidatorIntLessOrEqualToValid(t *testing.T)
- func TestValidatorIntLessThanInvalid(t *testing.T)
- func TestValidatorIntLessThanValid(t *testing.T)
- func TestValidatorIntNot(t *testing.T)
- func TestValidatorIntPBetweenInvalid(t *testing.T)
- func TestValidatorIntPBetweenValid(t *testing.T)
- func TestValidatorIntPEqualToInvalid(t *testing.T)
- func TestValidatorIntPEqualToValid(t *testing.T)
- func TestValidatorIntPGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorIntPGreaterOrEqualToValid(t *testing.T)
- func TestValidatorIntPGreaterThanInvalid(t *testing.T)
- func TestValidatorIntPGreaterThanValid(t *testing.T)
- func TestValidatorIntPInSliceInvalid(t *testing.T)
- func TestValidatorIntPInSliceValid(t *testing.T)
- func TestValidatorIntPLessOrEqualToInvalid(t *testing.T)
- func TestValidatorIntPLessOrEqualToValid(t *testing.T)
- func TestValidatorIntPLessThanInvalid(t *testing.T)
- func TestValidatorIntPLessThanValid(t *testing.T)
- func TestValidatorIntPNilIsInvalid(t *testing.T)
- func TestValidatorIntPNilIsValid(t *testing.T)
- func TestValidatorIntPNot(t *testing.T)
- func TestValidatorIntPPassingInvalid(t *testing.T)
- func TestValidatorIntPPassingValid(t *testing.T)
- func TestValidatorIntPZeroInvalid(t *testing.T)
- func TestValidatorIntPZeroOrNilInvalid(t *testing.T)
- func TestValidatorIntPZeroOrNilValid(t *testing.T)
- func TestValidatorIntPZeroValid(t *testing.T)
- func TestValidatorIntPassingInvalid(t *testing.T)
- func TestValidatorIntPassingValid(t *testing.T)
- func TestValidatorIntZeroInvalid(t *testing.T)
- func TestValidatorIntZeroValid(t *testing.T)
- func TestValidatorRuneBetweenInvalid(t *testing.T)
- func TestValidatorRuneBetweenValid(t *testing.T)
- func TestValidatorRuneEqualToInvalid(t *testing.T)
- func TestValidatorRuneEqualToValid(t *testing.T)
- func TestValidatorRuneGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorRuneGreaterOrEqualToValid(t *testing.T)
- func TestValidatorRuneGreaterThanInvalid(t *testing.T)
- func TestValidatorRuneGreaterThanValid(t *testing.T)
- func TestValidatorRuneInSliceInvalid(t *testing.T)
- func TestValidatorRuneInSliceValid(t *testing.T)
- func TestValidatorRuneLessOrEqualToInvalid(t *testing.T)
- func TestValidatorRuneLessOrEqualToValid(t *testing.T)
- func TestValidatorRuneLessThanInvalid(t *testing.T)
- func TestValidatorRuneLessThanValid(t *testing.T)
- func TestValidatorRuneNot(t *testing.T)
- func TestValidatorRunePBetweenInvalid(t *testing.T)
- func TestValidatorRunePBetweenValid(t *testing.T)
- func TestValidatorRunePEqualToInvalid(t *testing.T)
- func TestValidatorRunePEqualToValid(t *testing.T)
- func TestValidatorRunePGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorRunePGreaterOrEqualToValid(t *testing.T)
- func TestValidatorRunePGreaterThanInvalid(t *testing.T)
- func TestValidatorRunePGreaterThanValid(t *testing.T)
- func TestValidatorRunePInSliceInvalid(t *testing.T)
- func TestValidatorRunePInSliceValid(t *testing.T)
- func TestValidatorRunePLessOrEqualToInvalid(t *testing.T)
- func TestValidatorRunePLessOrEqualToValid(t *testing.T)
- func TestValidatorRunePLessThanInvalid(t *testing.T)
- func TestValidatorRunePLessThanValid(t *testing.T)
- func TestValidatorRunePNilIsInvalid(t *testing.T)
- func TestValidatorRunePNilIsValid(t *testing.T)
- func TestValidatorRunePNot(t *testing.T)
- func TestValidatorRunePPassingInvalid(t *testing.T)
- func TestValidatorRunePPassingValid(t *testing.T)
- func TestValidatorRunePZeroInvalid(t *testing.T)
- func TestValidatorRunePZeroOrNilInvalid(t *testing.T)
- func TestValidatorRunePZeroOrNilValid(t *testing.T)
- func TestValidatorRunePZeroValid(t *testing.T)
- func TestValidatorRunePassingInvalid(t *testing.T)
- func TestValidatorRunePassingValid(t *testing.T)
- func TestValidatorRuneZeroInvalid(t *testing.T)
- func TestValidatorRuneZeroValid(t *testing.T)
- func TestValidatorUint16BetweenInvalid(t *testing.T)
- func TestValidatorUint16BetweenValid(t *testing.T)
- func TestValidatorUint16EqualToInvalid(t *testing.T)
- func TestValidatorUint16EqualToValid(t *testing.T)
- func TestValidatorUint16GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorUint16GreaterOrEqualToValid(t *testing.T)
- func TestValidatorUint16GreaterThanInvalid(t *testing.T)
- func TestValidatorUint16GreaterThanValid(t *testing.T)
- func TestValidatorUint16InSliceInvalid(t *testing.T)
- func TestValidatorUint16InSliceValid(t *testing.T)
- func TestValidatorUint16LessOrEqualToInvalid(t *testing.T)
- func TestValidatorUint16LessOrEqualToValid(t *testing.T)
- func TestValidatorUint16LessThanInvalid(t *testing.T)
- func TestValidatorUint16LessThanValid(t *testing.T)
- func TestValidatorUint16Not(t *testing.T)
- func TestValidatorUint16PBetweenInvalid(t *testing.T)
- func TestValidatorUint16PBetweenValid(t *testing.T)
- func TestValidatorUint16PEqualToInvalid(t *testing.T)
- func TestValidatorUint16PEqualToValid(t *testing.T)
- func TestValidatorUint16PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorUint16PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorUint16PGreaterThanInvalid(t *testing.T)
- func TestValidatorUint16PGreaterThanValid(t *testing.T)
- func TestValidatorUint16PInSliceInvalid(t *testing.T)
- func TestValidatorUint16PInSliceValid(t *testing.T)
- func TestValidatorUint16PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorUint16PLessOrEqualToValid(t *testing.T)
- func TestValidatorUint16PLessThanInvalid(t *testing.T)
- func TestValidatorUint16PLessThanValid(t *testing.T)
- func TestValidatorUint16PNilIsInvalid(t *testing.T)
- func TestValidatorUint16PNilIsValid(t *testing.T)
- func TestValidatorUint16PNot(t *testing.T)
- func TestValidatorUint16PPassingInvalid(t *testing.T)
- func TestValidatorUint16PPassingValid(t *testing.T)
- func TestValidatorUint16PZeroInvalid(t *testing.T)
- func TestValidatorUint16PZeroOrNilInvalid(t *testing.T)
- func TestValidatorUint16PZeroOrNilValid(t *testing.T)
- func TestValidatorUint16PZeroValid(t *testing.T)
- func TestValidatorUint16PassingInvalid(t *testing.T)
- func TestValidatorUint16PassingValid(t *testing.T)
- func TestValidatorUint16ZeroInvalid(t *testing.T)
- func TestValidatorUint16ZeroValid(t *testing.T)
- func TestValidatorUint32BetweenInvalid(t *testing.T)
- func TestValidatorUint32BetweenValid(t *testing.T)
- func TestValidatorUint32EqualToInvalid(t *testing.T)
- func TestValidatorUint32EqualToValid(t *testing.T)
- func TestValidatorUint32GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorUint32GreaterOrEqualToValid(t *testing.T)
- func TestValidatorUint32GreaterThanInvalid(t *testing.T)
- func TestValidatorUint32GreaterThanValid(t *testing.T)
- func TestValidatorUint32InSliceInvalid(t *testing.T)
- func TestValidatorUint32InSliceValid(t *testing.T)
- func TestValidatorUint32LessOrEqualToInvalid(t *testing.T)
- func TestValidatorUint32LessOrEqualToValid(t *testing.T)
- func TestValidatorUint32LessThanInvalid(t *testing.T)
- func TestValidatorUint32LessThanValid(t *testing.T)
- func TestValidatorUint32Not(t *testing.T)
- func TestValidatorUint32PBetweenInvalid(t *testing.T)
- func TestValidatorUint32PBetweenValid(t *testing.T)
- func TestValidatorUint32PEqualToInvalid(t *testing.T)
- func TestValidatorUint32PEqualToValid(t *testing.T)
- func TestValidatorUint32PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorUint32PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorUint32PGreaterThanInvalid(t *testing.T)
- func TestValidatorUint32PGreaterThanValid(t *testing.T)
- func TestValidatorUint32PInSliceInvalid(t *testing.T)
- func TestValidatorUint32PInSliceValid(t *testing.T)
- func TestValidatorUint32PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorUint32PLessOrEqualToValid(t *testing.T)
- func TestValidatorUint32PLessThanInvalid(t *testing.T)
- func TestValidatorUint32PLessThanValid(t *testing.T)
- func TestValidatorUint32PNilIsInvalid(t *testing.T)
- func TestValidatorUint32PNilIsValid(t *testing.T)
- func TestValidatorUint32PNot(t *testing.T)
- func TestValidatorUint32PPassingInvalid(t *testing.T)
- func TestValidatorUint32PPassingValid(t *testing.T)
- func TestValidatorUint32PZeroInvalid(t *testing.T)
- func TestValidatorUint32PZeroOrNilInvalid(t *testing.T)
- func TestValidatorUint32PZeroOrNilValid(t *testing.T)
- func TestValidatorUint32PZeroValid(t *testing.T)
- func TestValidatorUint32PassingInvalid(t *testing.T)
- func TestValidatorUint32PassingValid(t *testing.T)
- func TestValidatorUint32ZeroInvalid(t *testing.T)
- func TestValidatorUint32ZeroValid(t *testing.T)
- func TestValidatorUint64BetweenInvalid(t *testing.T)
- func TestValidatorUint64BetweenValid(t *testing.T)
- func TestValidatorUint64EqualToInvalid(t *testing.T)
- func TestValidatorUint64EqualToValid(t *testing.T)
- func TestValidatorUint64GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorUint64GreaterOrEqualToValid(t *testing.T)
- func TestValidatorUint64GreaterThanInvalid(t *testing.T)
- func TestValidatorUint64GreaterThanValid(t *testing.T)
- func TestValidatorUint64InSliceInvalid(t *testing.T)
- func TestValidatorUint64InSliceValid(t *testing.T)
- func TestValidatorUint64LessOrEqualToInvalid(t *testing.T)
- func TestValidatorUint64LessOrEqualToValid(t *testing.T)
- func TestValidatorUint64LessThanInvalid(t *testing.T)
- func TestValidatorUint64LessThanValid(t *testing.T)
- func TestValidatorUint64Not(t *testing.T)
- func TestValidatorUint64PBetweenInvalid(t *testing.T)
- func TestValidatorUint64PBetweenValid(t *testing.T)
- func TestValidatorUint64PEqualToInvalid(t *testing.T)
- func TestValidatorUint64PEqualToValid(t *testing.T)
- func TestValidatorUint64PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorUint64PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorUint64PGreaterThanInvalid(t *testing.T)
- func TestValidatorUint64PGreaterThanValid(t *testing.T)
- func TestValidatorUint64PInSliceInvalid(t *testing.T)
- func TestValidatorUint64PInSliceValid(t *testing.T)
- func TestValidatorUint64PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorUint64PLessOrEqualToValid(t *testing.T)
- func TestValidatorUint64PLessThanInvalid(t *testing.T)
- func TestValidatorUint64PLessThanValid(t *testing.T)
- func TestValidatorUint64PNilIsInvalid(t *testing.T)
- func TestValidatorUint64PNilIsValid(t *testing.T)
- func TestValidatorUint64PNot(t *testing.T)
- func TestValidatorUint64PPassingInvalid(t *testing.T)
- func TestValidatorUint64PPassingValid(t *testing.T)
- func TestValidatorUint64PZeroInvalid(t *testing.T)
- func TestValidatorUint64PZeroOrNilInvalid(t *testing.T)
- func TestValidatorUint64PZeroOrNilValid(t *testing.T)
- func TestValidatorUint64PZeroValid(t *testing.T)
- func TestValidatorUint64PassingInvalid(t *testing.T)
- func TestValidatorUint64PassingValid(t *testing.T)
- func TestValidatorUint64ZeroInvalid(t *testing.T)
- func TestValidatorUint64ZeroValid(t *testing.T)
- func TestValidatorUint8BetweenInvalid(t *testing.T)
- func TestValidatorUint8BetweenValid(t *testing.T)
- func TestValidatorUint8EqualToInvalid(t *testing.T)
- func TestValidatorUint8EqualToValid(t *testing.T)
- func TestValidatorUint8GreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorUint8GreaterOrEqualToValid(t *testing.T)
- func TestValidatorUint8GreaterThanInvalid(t *testing.T)
- func TestValidatorUint8GreaterThanValid(t *testing.T)
- func TestValidatorUint8InSliceInvalid(t *testing.T)
- func TestValidatorUint8InSliceValid(t *testing.T)
- func TestValidatorUint8LessOrEqualToInvalid(t *testing.T)
- func TestValidatorUint8LessOrEqualToValid(t *testing.T)
- func TestValidatorUint8LessThanInvalid(t *testing.T)
- func TestValidatorUint8LessThanValid(t *testing.T)
- func TestValidatorUint8Not(t *testing.T)
- func TestValidatorUint8PBetweenInvalid(t *testing.T)
- func TestValidatorUint8PBetweenValid(t *testing.T)
- func TestValidatorUint8PEqualToInvalid(t *testing.T)
- func TestValidatorUint8PEqualToValid(t *testing.T)
- func TestValidatorUint8PGreaterOrEqualToInvalid(t *testing.T)
- func TestValidatorUint8PGreaterOrEqualToValid(t *testing.T)
- func TestValidatorUint8PGreaterThanInvalid(t *testing.T)
- func TestValidatorUint8PGreaterThanValid(t *testing.T)
- func TestValidatorUint8PInSliceInvalid(t *testing.T)
- func TestValidatorUint8PInSliceValid(t *testing.T)
- func TestValidatorUint8PLessOrEqualToInvalid(t *testing.T)
- func TestValidatorUint8PLessOrEqualToValid(t *testing.T)
- func TestValidatorUint8PLessThanInvalid(t *testing.T)
- func TestValidatorUint8PLessThanValid(t *testing.T)
- func TestValidatorUint8PNilIsInvalid(t *testing.T)
- func TestValidatorUint8PNilIsValid(t *testing.T)
- func TestValidatorUint8PNot(t *testing.T)
- func TestValidatorUint8PPassingInvalid(t *testing.T)
- func TestValidatorUint8PPassingValid(t *testing.T)
- func TestValidatorUint8PZeroInvalid(t *testing.T)
- func TestValidatorUint8PZeroOrNilInvalid(t *testing.T)
- func TestValidatorUint8PZeroOrNilValid(t *testing.T)
- func TestValidatorUint8PZeroValid(t *testing.T)
- func TestValidatorUint8PassingInvalid(t *testing.T)
- func TestValidatorUint8PassingValid(t *testing.T)
- func TestValidatorUint8ZeroInvalid(t *testing.T)
- func TestValidatorUint8ZeroValid(t *testing.T)
- type Error
- type FactoryOptions
- type Locale
- type Options
- type TypeNumber
- type Validation
- func (v *Validation) AddErrorMessage(name string, message string) *Validation
- func (validation *Validation) Check(v Validator) *Validation
- func (validation *Validation) Error() error
- func (session *Validation) Errors() map[string]*valueError
- func (validation *Validation) In(name string, _validation *Validation) *Validation
- func (validation *Validation) InRow(name string, index int, _validation *Validation) *Validation
- func (validation *Validation) Is(v Validator) *Validation
- func (validation *Validation) IsValid(name string) bool
- func (validation *Validation) Merge(_validation *Validation) *Validation
- func (v *Validation) MergeError(err *Error) *Validation
- func (v *Validation) MergeErrorIn(name string, err *Error) *Validation
- func (v *Validation) MergeErrorInRow(name string, index int, err *Error) *Validation
- func (validation *Validation) Valid() bool
- type ValidationFactory
- func (_factory *ValidationFactory) AddErrorMessage(name string, message string) *Validation
- func (_factory *ValidationFactory) Check(v Validator) *Validation
- func (_factory *ValidationFactory) In(name string, v *Validation) *Validation
- func (_factory *ValidationFactory) InRow(name string, index int, v *Validation) *Validation
- func (_factory *ValidationFactory) Is(v Validator) *Validation
- func (_factory *ValidationFactory) New(options ...Options) *Validation
- type Validator
- type ValidatorAny
- func (validator *ValidatorAny) Context() *ValidatorContext
- func (validator *ValidatorAny) EqualTo(value any, template ...string) *ValidatorAny
- func (validator *ValidatorAny) Nil(template ...string) *ValidatorAny
- func (validator *ValidatorAny) Not() *ValidatorAny
- func (validator *ValidatorAny) Passing(function func(v any) bool, template ...string) *ValidatorAny
- type ValidatorBool
- func (validator *ValidatorBool[T]) Context() *ValidatorContext
- func (validator *ValidatorBool[T]) EqualTo(value T, template ...string) *ValidatorBool[T]
- func (validator *ValidatorBool[T]) False(template ...string) *ValidatorBool[T]
- func (validator *ValidatorBool[T]) InSlice(slice []T, template ...string) *ValidatorBool[T]
- func (validator *ValidatorBool[T]) Not() *ValidatorBool[T]
- func (validator *ValidatorBool[T]) Passing(function func(v T) bool, template ...string) *ValidatorBool[T]
- func (validator *ValidatorBool[T]) True(template ...string) *ValidatorBool[T]
- type ValidatorBoolP
- func (validator *ValidatorBoolP[T]) Context() *ValidatorContext
- func (validator *ValidatorBoolP[T]) EqualTo(value T, template ...string) *ValidatorBoolP[T]
- func (validator *ValidatorBoolP[T]) False(template ...string) *ValidatorBoolP[T]
- func (validator *ValidatorBoolP[T]) FalseOrNil(template ...string) *ValidatorBoolP[T]
- func (validator *ValidatorBoolP[T]) InSlice(slice []T, template ...string) *ValidatorBoolP[T]
- func (validator *ValidatorBoolP[T]) Nil(template ...string) *ValidatorBoolP[T]
- func (validator *ValidatorBoolP[T]) Not() *ValidatorBoolP[T]
- func (validator *ValidatorBoolP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorBoolP[T]
- func (validator *ValidatorBoolP[T]) True(template ...string) *ValidatorBoolP[T]
- type ValidatorByte
- func (validator *ValidatorByte[T]) Between(min T, max T, template ...string) *ValidatorByte[T]
- func (validator *ValidatorByte[T]) Context() *ValidatorContext
- func (validator *ValidatorByte[T]) EqualTo(value T, template ...string) *ValidatorByte[T]
- func (validator *ValidatorByte[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorByte[T]
- func (validator *ValidatorByte[T]) GreaterThan(value T, template ...string) *ValidatorByte[T]
- func (validator *ValidatorByte[T]) InSlice(slice []T, template ...string) *ValidatorByte[T]
- func (validator *ValidatorByte[T]) LessOrEqualTo(value T, template ...string) *ValidatorByte[T]
- func (validator *ValidatorByte[T]) LessThan(value T, template ...string) *ValidatorByte[T]
- func (validator *ValidatorByte[T]) Not() *ValidatorByte[T]
- func (validator *ValidatorByte[T]) Passing(function func(v T) bool, template ...string) *ValidatorByte[T]
- func (validator *ValidatorByte[T]) Zero(template ...string) *ValidatorByte[T]
- type ValidatorByteP
- func (validator *ValidatorByteP[T]) Between(min T, max T, template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) Context() *ValidatorContext
- func (validator *ValidatorByteP[T]) EqualTo(value T, template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) GreaterThan(value T, template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) InSlice(slice []T, template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) LessOrEqualTo(value T, template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) LessThan(value T, template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) Nil(template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) Not() *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) Zero(template ...string) *ValidatorByteP[T]
- func (validator *ValidatorByteP[T]) ZeroOrNil(template ...string) *ValidatorByteP[T]
- type ValidatorContext
- func (ctx *ValidatorContext) Add(function func() bool, errorKey string, template ...string) *ValidatorContext
- func (ctx *ValidatorContext) AddWithParams(function func() bool, errorKey string, templateParams map[string]any, ...) *ValidatorContext
- func (ctx *ValidatorContext) AddWithValue(function func() bool, errorKey string, value any, template ...string) *ValidatorContext
- func (ctx *ValidatorContext) Not() *ValidatorContext
- func (ctx *ValidatorContext) Value() any
- type ValidatorFloat32
- func (validator *ValidatorFloat32[T]) Between(min T, max T, template ...string) *ValidatorFloat32[T]
- func (validator *ValidatorFloat32[T]) Context() *ValidatorContext
- func (validator *ValidatorFloat32[T]) EqualTo(value T, template ...string) *ValidatorFloat32[T]
- func (validator *ValidatorFloat32[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorFloat32[T]
- func (validator *ValidatorFloat32[T]) GreaterThan(value T, template ...string) *ValidatorFloat32[T]
- func (validator *ValidatorFloat32[T]) InSlice(slice []T, template ...string) *ValidatorFloat32[T]
- func (validator *ValidatorFloat32[T]) LessOrEqualTo(value T, template ...string) *ValidatorFloat32[T]
- func (validator *ValidatorFloat32[T]) LessThan(value T, template ...string) *ValidatorFloat32[T]
- func (validator *ValidatorFloat32[T]) Not() *ValidatorFloat32[T]
- func (validator *ValidatorFloat32[T]) Passing(function func(v T) bool, template ...string) *ValidatorFloat32[T]
- func (validator *ValidatorFloat32[T]) Zero(template ...string) *ValidatorFloat32[T]
- type ValidatorFloat32P
- func (validator *ValidatorFloat32P[T]) Between(min T, max T, template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) Context() *ValidatorContext
- func (validator *ValidatorFloat32P[T]) EqualTo(value T, template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) GreaterThan(value T, template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) InSlice(slice []T, template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) LessOrEqualTo(value T, template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) LessThan(value T, template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) Nil(template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) Not() *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) Zero(template ...string) *ValidatorFloat32P[T]
- func (validator *ValidatorFloat32P[T]) ZeroOrNil(template ...string) *ValidatorFloat32P[T]
- type ValidatorFloat64
- func (validator *ValidatorFloat64[T]) Between(min T, max T, template ...string) *ValidatorFloat64[T]
- func (validator *ValidatorFloat64[T]) Context() *ValidatorContext
- func (validator *ValidatorFloat64[T]) EqualTo(value T, template ...string) *ValidatorFloat64[T]
- func (validator *ValidatorFloat64[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorFloat64[T]
- func (validator *ValidatorFloat64[T]) GreaterThan(value T, template ...string) *ValidatorFloat64[T]
- func (validator *ValidatorFloat64[T]) InSlice(slice []T, template ...string) *ValidatorFloat64[T]
- func (validator *ValidatorFloat64[T]) LessOrEqualTo(value T, template ...string) *ValidatorFloat64[T]
- func (validator *ValidatorFloat64[T]) LessThan(value T, template ...string) *ValidatorFloat64[T]
- func (validator *ValidatorFloat64[T]) Not() *ValidatorFloat64[T]
- func (validator *ValidatorFloat64[T]) Passing(function func(v T) bool, template ...string) *ValidatorFloat64[T]
- func (validator *ValidatorFloat64[T]) Zero(template ...string) *ValidatorFloat64[T]
- type ValidatorFloat64P
- func (validator *ValidatorFloat64P[T]) Between(min T, max T, template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) Context() *ValidatorContext
- func (validator *ValidatorFloat64P[T]) EqualTo(value T, template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) GreaterThan(value T, template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) InSlice(slice []T, template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) LessOrEqualTo(value T, template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) LessThan(value T, template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) Nil(template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) Not() *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) Zero(template ...string) *ValidatorFloat64P[T]
- func (validator *ValidatorFloat64P[T]) ZeroOrNil(template ...string) *ValidatorFloat64P[T]
- type ValidatorInt
- func (validator *ValidatorInt[T]) Between(min T, max T, template ...string) *ValidatorInt[T]
- func (validator *ValidatorInt[T]) Context() *ValidatorContext
- func (validator *ValidatorInt[T]) EqualTo(value T, template ...string) *ValidatorInt[T]
- func (validator *ValidatorInt[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt[T]
- func (validator *ValidatorInt[T]) GreaterThan(value T, template ...string) *ValidatorInt[T]
- func (validator *ValidatorInt[T]) InSlice(slice []T, template ...string) *ValidatorInt[T]
- func (validator *ValidatorInt[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt[T]
- func (validator *ValidatorInt[T]) LessThan(value T, template ...string) *ValidatorInt[T]
- func (validator *ValidatorInt[T]) Not() *ValidatorInt[T]
- func (validator *ValidatorInt[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt[T]
- func (validator *ValidatorInt[T]) Zero(template ...string) *ValidatorInt[T]
- type ValidatorInt16
- func (validator *ValidatorInt16[T]) Between(min T, max T, template ...string) *ValidatorInt16[T]
- func (validator *ValidatorInt16[T]) Context() *ValidatorContext
- func (validator *ValidatorInt16[T]) EqualTo(value T, template ...string) *ValidatorInt16[T]
- func (validator *ValidatorInt16[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt16[T]
- func (validator *ValidatorInt16[T]) GreaterThan(value T, template ...string) *ValidatorInt16[T]
- func (validator *ValidatorInt16[T]) InSlice(slice []T, template ...string) *ValidatorInt16[T]
- func (validator *ValidatorInt16[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt16[T]
- func (validator *ValidatorInt16[T]) LessThan(value T, template ...string) *ValidatorInt16[T]
- func (validator *ValidatorInt16[T]) Not() *ValidatorInt16[T]
- func (validator *ValidatorInt16[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt16[T]
- func (validator *ValidatorInt16[T]) Zero(template ...string) *ValidatorInt16[T]
- type ValidatorInt16P
- func (validator *ValidatorInt16P[T]) Between(min T, max T, template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) Context() *ValidatorContext
- func (validator *ValidatorInt16P[T]) EqualTo(value T, template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) GreaterThan(value T, template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) InSlice(slice []T, template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) LessThan(value T, template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) Nil(template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) Not() *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) Zero(template ...string) *ValidatorInt16P[T]
- func (validator *ValidatorInt16P[T]) ZeroOrNil(template ...string) *ValidatorInt16P[T]
- type ValidatorInt32
- func (validator *ValidatorInt32[T]) Between(min T, max T, template ...string) *ValidatorInt32[T]
- func (validator *ValidatorInt32[T]) Context() *ValidatorContext
- func (validator *ValidatorInt32[T]) EqualTo(value T, template ...string) *ValidatorInt32[T]
- func (validator *ValidatorInt32[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt32[T]
- func (validator *ValidatorInt32[T]) GreaterThan(value T, template ...string) *ValidatorInt32[T]
- func (validator *ValidatorInt32[T]) InSlice(slice []T, template ...string) *ValidatorInt32[T]
- func (validator *ValidatorInt32[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt32[T]
- func (validator *ValidatorInt32[T]) LessThan(value T, template ...string) *ValidatorInt32[T]
- func (validator *ValidatorInt32[T]) Not() *ValidatorInt32[T]
- func (validator *ValidatorInt32[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt32[T]
- func (validator *ValidatorInt32[T]) Zero(template ...string) *ValidatorInt32[T]
- type ValidatorInt32P
- func (validator *ValidatorInt32P[T]) Between(min T, max T, template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) Context() *ValidatorContext
- func (validator *ValidatorInt32P[T]) EqualTo(value T, template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) GreaterThan(value T, template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) InSlice(slice []T, template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) LessThan(value T, template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) Nil(template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) Not() *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) Zero(template ...string) *ValidatorInt32P[T]
- func (validator *ValidatorInt32P[T]) ZeroOrNil(template ...string) *ValidatorInt32P[T]
- type ValidatorInt64
- func (validator *ValidatorInt64[T]) Between(min T, max T, template ...string) *ValidatorInt64[T]
- func (validator *ValidatorInt64[T]) Context() *ValidatorContext
- func (validator *ValidatorInt64[T]) EqualTo(value T, template ...string) *ValidatorInt64[T]
- func (validator *ValidatorInt64[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt64[T]
- func (validator *ValidatorInt64[T]) GreaterThan(value T, template ...string) *ValidatorInt64[T]
- func (validator *ValidatorInt64[T]) InSlice(slice []T, template ...string) *ValidatorInt64[T]
- func (validator *ValidatorInt64[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt64[T]
- func (validator *ValidatorInt64[T]) LessThan(value T, template ...string) *ValidatorInt64[T]
- func (validator *ValidatorInt64[T]) Not() *ValidatorInt64[T]
- func (validator *ValidatorInt64[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt64[T]
- func (validator *ValidatorInt64[T]) Zero(template ...string) *ValidatorInt64[T]
- type ValidatorInt64P
- func (validator *ValidatorInt64P[T]) Between(min T, max T, template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) Context() *ValidatorContext
- func (validator *ValidatorInt64P[T]) EqualTo(value T, template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) GreaterThan(value T, template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) InSlice(slice []T, template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) LessThan(value T, template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) Nil(template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) Not() *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) Zero(template ...string) *ValidatorInt64P[T]
- func (validator *ValidatorInt64P[T]) ZeroOrNil(template ...string) *ValidatorInt64P[T]
- type ValidatorInt8
- func (validator *ValidatorInt8[T]) Between(min T, max T, template ...string) *ValidatorInt8[T]
- func (validator *ValidatorInt8[T]) Context() *ValidatorContext
- func (validator *ValidatorInt8[T]) EqualTo(value T, template ...string) *ValidatorInt8[T]
- func (validator *ValidatorInt8[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt8[T]
- func (validator *ValidatorInt8[T]) GreaterThan(value T, template ...string) *ValidatorInt8[T]
- func (validator *ValidatorInt8[T]) InSlice(slice []T, template ...string) *ValidatorInt8[T]
- func (validator *ValidatorInt8[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt8[T]
- func (validator *ValidatorInt8[T]) LessThan(value T, template ...string) *ValidatorInt8[T]
- func (validator *ValidatorInt8[T]) Not() *ValidatorInt8[T]
- func (validator *ValidatorInt8[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt8[T]
- func (validator *ValidatorInt8[T]) Zero(template ...string) *ValidatorInt8[T]
- type ValidatorInt8P
- func (validator *ValidatorInt8P[T]) Between(min T, max T, template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) Context() *ValidatorContext
- func (validator *ValidatorInt8P[T]) EqualTo(value T, template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) GreaterThan(value T, template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) InSlice(slice []T, template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) LessThan(value T, template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) Nil(template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) Not() *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) Zero(template ...string) *ValidatorInt8P[T]
- func (validator *ValidatorInt8P[T]) ZeroOrNil(template ...string) *ValidatorInt8P[T]
- type ValidatorIntP
- func (validator *ValidatorIntP[T]) Between(min T, max T, template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) Context() *ValidatorContext
- func (validator *ValidatorIntP[T]) EqualTo(value T, template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) GreaterThan(value T, template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) InSlice(slice []T, template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) LessOrEqualTo(value T, template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) LessThan(value T, template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) Nil(template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) Not() *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) Zero(template ...string) *ValidatorIntP[T]
- func (validator *ValidatorIntP[T]) ZeroOrNil(template ...string) *ValidatorIntP[T]
- type ValidatorNumber
- func (validator *ValidatorNumber[T]) Between(min T, max T, template ...string) *ValidatorNumber[T]
- func (validator *ValidatorNumber[T]) Context() *ValidatorContext
- func (validator *ValidatorNumber[T]) EqualTo(value T, template ...string) *ValidatorNumber[T]
- func (validator *ValidatorNumber[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorNumber[T]
- func (validator *ValidatorNumber[T]) GreaterThan(value T, template ...string) *ValidatorNumber[T]
- func (validator *ValidatorNumber[T]) InSlice(slice []T, template ...string) *ValidatorNumber[T]
- func (validator *ValidatorNumber[T]) LessOrEqualTo(value T, template ...string) *ValidatorNumber[T]
- func (validator *ValidatorNumber[T]) LessThan(value T, template ...string) *ValidatorNumber[T]
- func (validator *ValidatorNumber[T]) Not() *ValidatorNumber[T]
- func (validator *ValidatorNumber[T]) Passing(function func(v T) bool, template ...string) *ValidatorNumber[T]
- func (validator *ValidatorNumber[T]) Zero(template ...string) *ValidatorNumber[T]
- type ValidatorNumberP
- func (validator *ValidatorNumberP[T]) Between(min T, max T, template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) Context() *ValidatorContext
- func (validator *ValidatorNumberP[T]) EqualTo(value T, template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) GreaterThan(value T, template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) InSlice(slice []T, template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) LessOrEqualTo(value T, template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) LessThan(value T, template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) Nil(template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) Not() *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) Zero(template ...string) *ValidatorNumberP[T]
- func (validator *ValidatorNumberP[T]) ZeroOrNil(template ...string) *ValidatorNumberP[T]
- type ValidatorRune
- func (validator *ValidatorRune[T]) Between(min T, max T, template ...string) *ValidatorRune[T]
- func (validator *ValidatorRune[T]) Context() *ValidatorContext
- func (validator *ValidatorRune[T]) EqualTo(value T, template ...string) *ValidatorRune[T]
- func (validator *ValidatorRune[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorRune[T]
- func (validator *ValidatorRune[T]) GreaterThan(value T, template ...string) *ValidatorRune[T]
- func (validator *ValidatorRune[T]) InSlice(slice []T, template ...string) *ValidatorRune[T]
- func (validator *ValidatorRune[T]) LessOrEqualTo(value T, template ...string) *ValidatorRune[T]
- func (validator *ValidatorRune[T]) LessThan(value T, template ...string) *ValidatorRune[T]
- func (validator *ValidatorRune[T]) Not() *ValidatorRune[T]
- func (validator *ValidatorRune[T]) Passing(function func(v T) bool, template ...string) *ValidatorRune[T]
- func (validator *ValidatorRune[T]) Zero(template ...string) *ValidatorRune[T]
- type ValidatorRuneP
- func (validator *ValidatorRuneP[T]) Between(min T, max T, template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) Context() *ValidatorContext
- func (validator *ValidatorRuneP[T]) EqualTo(value T, template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) GreaterThan(value T, template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) InSlice(slice []T, template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) LessOrEqualTo(value T, template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) LessThan(value T, template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) Nil(template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) Not() *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) Zero(template ...string) *ValidatorRuneP[T]
- func (validator *ValidatorRuneP[T]) ZeroOrNil(template ...string) *ValidatorRuneP[T]
- type ValidatorString
- func (validator *ValidatorString[T]) Between(min T, max T, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) Blank(template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) Context() *ValidatorContext
- func (validator *ValidatorString[T]) Empty(template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) EqualTo(value T, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) GreaterThan(value T, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) InSlice(slice []T, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) LessOrEqualTo(value T, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) LessThan(value T, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) MatchingTo(regex *regexp.Regexp, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) MaxLength(length int, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) MinLength(length int, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) Not() *ValidatorString[T]
- func (validator *ValidatorString[T]) OfLength(length int, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) OfLengthBetween(min int, max int, template ...string) *ValidatorString[T]
- func (validator *ValidatorString[T]) Passing(function func(v0 T) bool, template ...string) *ValidatorString[T]
- type ValidatorStringP
- func (validator *ValidatorStringP[T]) Between(min T, max T, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) Blank(template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) BlankOrNil(template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) Context() *ValidatorContext
- func (validator *ValidatorStringP[T]) Empty(template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) EmptyOrNil(template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) EqualTo(value T, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) GreaterThan(value T, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) InSlice(slice []T, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) LessOrEqualTo(value T, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) LessThan(value T, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) MatchingTo(regex *regexp.Regexp, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) MaxLength(length int, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) MinLength(length int, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) Nil(template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) Not() *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) OfLength(length int, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) OfLengthBetween(min int, max int, template ...string) *ValidatorStringP[T]
- func (validator *ValidatorStringP[T]) Passing(function func(v0 *T) bool, template ...string) *ValidatorStringP[T]
- type ValidatorUint16
- func (validator *ValidatorUint16[T]) Between(min T, max T, template ...string) *ValidatorUint16[T]
- func (validator *ValidatorUint16[T]) Context() *ValidatorContext
- func (validator *ValidatorUint16[T]) EqualTo(value T, template ...string) *ValidatorUint16[T]
- func (validator *ValidatorUint16[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint16[T]
- func (validator *ValidatorUint16[T]) GreaterThan(value T, template ...string) *ValidatorUint16[T]
- func (validator *ValidatorUint16[T]) InSlice(slice []T, template ...string) *ValidatorUint16[T]
- func (validator *ValidatorUint16[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint16[T]
- func (validator *ValidatorUint16[T]) LessThan(value T, template ...string) *ValidatorUint16[T]
- func (validator *ValidatorUint16[T]) Not() *ValidatorUint16[T]
- func (validator *ValidatorUint16[T]) Passing(function func(v T) bool, template ...string) *ValidatorUint16[T]
- func (validator *ValidatorUint16[T]) Zero(template ...string) *ValidatorUint16[T]
- type ValidatorUint16P
- func (validator *ValidatorUint16P[T]) Between(min T, max T, template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) Context() *ValidatorContext
- func (validator *ValidatorUint16P[T]) EqualTo(value T, template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) GreaterThan(value T, template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) InSlice(slice []T, template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) LessThan(value T, template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) Nil(template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) Not() *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) Zero(template ...string) *ValidatorUint16P[T]
- func (validator *ValidatorUint16P[T]) ZeroOrNil(template ...string) *ValidatorUint16P[T]
- type ValidatorUint32
- func (validator *ValidatorUint32[T]) Between(min T, max T, template ...string) *ValidatorUint32[T]
- func (validator *ValidatorUint32[T]) Context() *ValidatorContext
- func (validator *ValidatorUint32[T]) EqualTo(value T, template ...string) *ValidatorUint32[T]
- func (validator *ValidatorUint32[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint32[T]
- func (validator *ValidatorUint32[T]) GreaterThan(value T, template ...string) *ValidatorUint32[T]
- func (validator *ValidatorUint32[T]) InSlice(slice []T, template ...string) *ValidatorUint32[T]
- func (validator *ValidatorUint32[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint32[T]
- func (validator *ValidatorUint32[T]) LessThan(value T, template ...string) *ValidatorUint32[T]
- func (validator *ValidatorUint32[T]) Not() *ValidatorUint32[T]
- func (validator *ValidatorUint32[T]) Passing(function func(v T) bool, template ...string) *ValidatorUint32[T]
- func (validator *ValidatorUint32[T]) Zero(template ...string) *ValidatorUint32[T]
- type ValidatorUint32P
- func (validator *ValidatorUint32P[T]) Between(min T, max T, template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) Context() *ValidatorContext
- func (validator *ValidatorUint32P[T]) EqualTo(value T, template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) GreaterThan(value T, template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) InSlice(slice []T, template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) LessThan(value T, template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) Nil(template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) Not() *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) Zero(template ...string) *ValidatorUint32P[T]
- func (validator *ValidatorUint32P[T]) ZeroOrNil(template ...string) *ValidatorUint32P[T]
- type ValidatorUint64
- func (validator *ValidatorUint64[T]) Between(min T, max T, template ...string) *ValidatorUint64[T]
- func (validator *ValidatorUint64[T]) Context() *ValidatorContext
- func (validator *ValidatorUint64[T]) EqualTo(value T, template ...string) *ValidatorUint64[T]
- func (validator *ValidatorUint64[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint64[T]
- func (validator *ValidatorUint64[T]) GreaterThan(value T, template ...string) *ValidatorUint64[T]
- func (validator *ValidatorUint64[T]) InSlice(slice []T, template ...string) *ValidatorUint64[T]
- func (validator *ValidatorUint64[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint64[T]
- func (validator *ValidatorUint64[T]) LessThan(value T, template ...string) *ValidatorUint64[T]
- func (validator *ValidatorUint64[T]) Not() *ValidatorUint64[T]
- func (validator *ValidatorUint64[T]) Passing(function func(v T) bool, template ...string) *ValidatorUint64[T]
- func (validator *ValidatorUint64[T]) Zero(template ...string) *ValidatorUint64[T]
- type ValidatorUint64P
- func (validator *ValidatorUint64P[T]) Between(min T, max T, template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) Context() *ValidatorContext
- func (validator *ValidatorUint64P[T]) EqualTo(value T, template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) GreaterThan(value T, template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) InSlice(slice []T, template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) LessThan(value T, template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) Nil(template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) Not() *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) Zero(template ...string) *ValidatorUint64P[T]
- func (validator *ValidatorUint64P[T]) ZeroOrNil(template ...string) *ValidatorUint64P[T]
- type ValidatorUint8
- func (validator *ValidatorUint8[T]) Between(min T, max T, template ...string) *ValidatorUint8[T]
- func (validator *ValidatorUint8[T]) Context() *ValidatorContext
- func (validator *ValidatorUint8[T]) EqualTo(value T, template ...string) *ValidatorUint8[T]
- func (validator *ValidatorUint8[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint8[T]
- func (validator *ValidatorUint8[T]) GreaterThan(value T, template ...string) *ValidatorUint8[T]
- func (validator *ValidatorUint8[T]) InSlice(slice []T, template ...string) *ValidatorUint8[T]
- func (validator *ValidatorUint8[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint8[T]
- func (validator *ValidatorUint8[T]) LessThan(value T, template ...string) *ValidatorUint8[T]
- func (validator *ValidatorUint8[T]) Not() *ValidatorUint8[T]
- func (validator *ValidatorUint8[T]) Passing(function func(v T) bool, template ...string) *ValidatorUint8[T]
- func (validator *ValidatorUint8[T]) Zero(template ...string) *ValidatorUint8[T]
- type ValidatorUint8P
- func (validator *ValidatorUint8P[T]) Between(min T, max T, template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) Context() *ValidatorContext
- func (validator *ValidatorUint8P[T]) EqualTo(value T, template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) GreaterThan(value T, template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) InSlice(slice []T, template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) LessThan(value T, template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) Nil(template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) Not() *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) Zero(template ...string) *ValidatorUint8P[T]
- func (validator *ValidatorUint8P[T]) ZeroOrNil(template ...string) *ValidatorUint8P[T]
Examples ¶
Constants ¶
const ( ErrorKeyBetween = "between" ErrorKeyNotBetween = "not_between" ErrorKeyBlank = "blank" ErrorKeyNotBlank = "not_blank" ErrorKeyEmpty = "empty" ErrorKeyNotEmpty = "not_empty" ErrorKeyEqualTo = "equal_to" ErrorKeyNotEqualTo = "not_equal_to" ErrorKeyFalse = "false" ErrorKeyNotFalse = "not_false" ErrorKeyGreaterOrEqualTo = "greater_equal_to" ErrorKeyNotGreaterOrEqualTo = "not_greater_equal_to" ErrorKeyGreaterThan = "greater_than" ErrorKeyNotGreaterThan = "not_greater_than" ErrorKeyInSlice = "in_slice" ErrorKeyNotInSlice = "not_in_slice" ErrorKeyLength = "length" ErrorKeyNotLength = "not_length" ErrorKeyLengthBetween = "length_between" ErrorKeyNotLengthBetween = "not_length_between" ErrorKeyLessOrEqualTo = "less_or_equal_to" ErrorKeyNotLessOrEqualTo = "not_less_or_equal_to" ErrorKeyLessThan = "less_than" ErrorKeyNotLessThan = "not_less_than" ErrorKeyMatchingTo = "matching_to" ErrorKeyNotMatchingTo = "not_matching_to" ErrorKeyMaxLength = "max_length" ErrorKeyNotMaxLength = "not_max_length" ErrorKeyMinLength = "min_length" ErrorKeyNotMinLength = "not_min_length" ErrorKeyNil = "nil" ErrorKeyNotNil = "not_nil" ErrorKeyPassing = "passing" ErrorKeyNotPassing = "not_passing" ErrorKeyTrue = "true" ErrorKeyNotTrue = "not_true" ErrorKeyZero = "zero" ErrorKeyNotZero = "not_zero" )
const ( LocaleCodeEn = "en" LocaleCodeEs = "es" LocaleCodeDe = "de" )
Variables ¶
This section is empty.
Functions ¶
func TestValidatorByteNot ¶
func TestValidatorBytePNot ¶
func TestValidatorFloat32Not ¶
func TestValidatorFloat64Not ¶
func TestValidatorInt16Not ¶
func TestValidatorInt16PNot ¶
func TestValidatorInt32Not ¶
func TestValidatorInt32PNot ¶
func TestValidatorInt64Not ¶
func TestValidatorInt64PNot ¶
func TestValidatorInt8Not ¶
func TestValidatorInt8PNot ¶
func TestValidatorIntNot ¶
func TestValidatorIntPNot ¶
func TestValidatorRuneNot ¶
func TestValidatorRunePNot ¶
func TestValidatorUint16Not ¶
func TestValidatorUint16PNot ¶
func TestValidatorUint32Not ¶
func TestValidatorUint32PNot ¶
func TestValidatorUint64Not ¶
func TestValidatorUint64PNot ¶
func TestValidatorUint8Not ¶
func TestValidatorUint8PNot ¶
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Implementation of the Go error interface in Valgo. The [Validation.Error()] method returns a value of this type.
There is a function in this type, [Errors()], that returns a list of errors in a Validation session.
func (*Error) MarshalJSON ¶
Return the JSON encoding of the validation error messages.
A custom function can be set with [SetMarshalJson()]
type FactoryOptions ¶
type FactoryOptions struct { // A string field that represents the default locale code to use by the // factory if a specific locale code is not provided when a Validation is // created LocaleCodeDefault string // A map field that allows to modify the current or add new locales Locales map[string]*Locale // A function field that allows to set a custom JSON marshaler for [Error] MarshalJsonFunc func(e *Error) ([]byte, error) }
FactoryOptions is a struct in Go that is used to pass options to a [Factory()]
type Locale ¶
Locale is a type alias that represents a map of locale entries. The keys in the map are strings that represent the entry's identifier, and the values are strings that contain the corresponding localized text for that entry
type Options ¶
type Options struct { // A string field that represents the locale code to use by the [Validation] // session LocaleCode string // A map field that allows to modify or add a new [Locale] Locale *Locale // A function field that allows to set a custom JSON marshaler for [Error] MarshalJsonFunc func(e *Error) ([]byte, error) // contains filtered or unexported fields }
type TypeNumber ¶
type TypeNumber interface { ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 }
Custom generic type covering all numeric types. This type is used as the value type in ValidatorNumber and ValidatorNumberP.
type Validation ¶
type Validation struct {
// contains filtered or unexported fields
}
The Validation session in Valgo is the main structure for validating one or more values. It is called Validation in code.
A Validation session will contain one or more Validators, where each Validator will have the responsibility to validate a value with one or more rules.
There are multiple functions to create a Validation session, depending on the requirements:
the function Is(...) is likely to be the most frequently used function in your validations. When Is(...) is called, the function creates a validation and receives a validator at the same time.
func AddErrorMessage ¶
func AddErrorMessage(name string, message string) *Validation
Create a new Validation session and add an error message to it without executing a field validator. By adding this error message, the Validation session will be marked as invalid.
func Check ¶
func Check(v Validator) *Validation
The Check(...) function is similar to the Is(...) function, however with Check(...)` the Rules of the Validator parameter are not short-circuited, which means that regardless of whether a previous rule was valid, all rules are checked.
This example shows two rules that fail due to the empty value in the full_name Validator, and since the Validator is not short-circuited, both error messages are added to the error result.
Example ¶
val := Check(String("", "full_name").Not().Blank().OfLengthBetween(4, 20)) if !val.Valid() { out, _ := json.MarshalIndent(val.Error(), "", " ") fmt.Println(string(out)) }
Output: { "full_name": [ "Full name can't be blank", "Full name must have a length between \"4\" and \"20\"" ] }
func In ¶
func In(name string, v *Validation) *Validation
The In(...) function executes one or more validators in a namespace, so the value names in the error result are prefixed with this namespace. This is useful for validating nested structures.
In the following example we are validating the Person and the nested Address structure. We can distinguish the errors of the nested Address structure in the error results.
Example ¶
type Address struct { Name string Street string } type Person struct { Name string Address Address } p := Person{"Bob", Address{"", "1600 Amphitheatre Pkwy"}} val := Is(String(p.Name, "name").OfLengthBetween(4, 20)). In("address", Is( String(p.Address.Name, "name").Not().Blank()).Is( String(p.Address.Street, "street").Not().Blank())) if !val.Valid() { out, _ := json.MarshalIndent(val.Error(), "", " ") fmt.Println(string(out)) }
Output: { "address.name": [ "Name can't be blank" ], "name": [ "Name must have a length between \"4\" and \"20\"" ] }
func InRow ¶
func InRow(name string, index int, v *Validation) *Validation
The InRow(...) function executes one or more validators in a namespace similar to the In(...) function, but with indexed namespace. So, the value names in the error result are prefixed with this indexed namespace. It is useful for validating nested lists in structures.
In the following example we validate the Person and the nested list Addresses. The error results can distinguish the errors of the nested list Addresses.
Example ¶
type Address struct { Name string Street string } type Person struct { Name string Addresses []Address } p := Person{ "Bob", []Address{ {"", "1600 Amphitheatre Pkwy"}, {"Home", ""}, }, } val := Is(String(p.Name, "name").OfLengthBetween(4, 20)) for i, a := range p.Addresses { val.InRow("addresses", i, Is( String(a.Name, "name").Not().Blank()).Is( String(a.Street, "street").Not().Blank())) } if !val.Valid() { out, _ := json.MarshalIndent(val.Error(), "", " ") fmt.Println(string(out)) }
Output: { "addresses[0].name": [ "Name can't be blank" ], "addresses[1].street": [ "Street can't be blank" ], "name": [ "Name must have a length between \"4\" and \"20\"" ] }
func Is ¶
func Is(v Validator) *Validation
The Is(...) function allows you to pass a Validator with the value and the rules for validating it. At the same time, create a Validation session, which lets you add more Validators in order to verify more values.
As shown in the following example, we are passing to the function Is(...) the Validator for the full_name value. The function returns a Validation session that allows us to add more Validators to validate more values; in the example case the values age and status:
Example ¶
val := Is(String("Bob", "full_name").Not().Blank().OfLengthBetween(4, 20)). Is(Number(17, "age").GreaterThan(18)). Is(String("singl", "status").InSlice([]string{"married", "single"})) if !val.Valid() { out, _ := json.MarshalIndent(val.Error(), "", " ") fmt.Println(string(out)) }
Output: { "age": [ "Age must be greater than \"18\"" ], "full_name": [ "Full name must have a length between \"4\" and \"20\"" ], "status": [ "Status is not valid" ] }
func New ¶
func New(options ...Options) *Validation
This function allows you to create a new Validation session without a Validator. This is useful for conditional validation, reusing validation logic or just to pass optional parameters to the Validation session.
The function accepts an optional parameter of type Options struct, which allows you to specify options such as the specific locale code and locale to use, and a custom JSON marshaler for errors.
The following example conditionally adds a validator rule for the month_day value.
Example ¶
month := 5 monthDay := 11 val := New() if month == 6 { val.Is(Number(monthDay, "month_day").LessOrEqualTo(10)) } if val.Valid() { fmt.Println("The validation passes") }
Output: The validation passes
func (*Validation) AddErrorMessage ¶
func (v *Validation) AddErrorMessage(name string, message string) *Validation
Add an error message to the Validation session without executing a field validator. By adding this error message, the Validation session will be marked as invalid.
func (*Validation) Check ¶
func (validation *Validation) Check(v Validator) *Validation
Add a field validator to a Validation session. But unlike [Is()] the field validator is not short-circuited.
func (*Validation) Error ¶
func (validation *Validation) Error() error
Return a map with the information for each invalid field validator in the Validation session.
func (*Validation) Errors ¶
func (session *Validation) Errors() map[string]*valueError
Return a map with the information for each invalid field validator in the Validation session.
func (*Validation) In ¶
func (validation *Validation) In(name string, _validation *Validation) *Validation
Add a map namespace to a Validation session.
func (*Validation) InRow ¶
func (validation *Validation) InRow(name string, index int, _validation *Validation) *Validation
Add an indexed namespace to a Validation session.
func (*Validation) Is ¶
func (validation *Validation) Is(v Validator) *Validation
Add a field validator to a Validation session.
func (*Validation) IsValid ¶
func (validation *Validation) IsValid(name string) bool
Return true if a specific field validator is valid.
Example ¶
val := Is(Number(16, "age").GreaterThan(18)). Is(String("single", "status").InSlice([]string{"married", "single"})) if !val.IsValid("age") { fmt.Println("Warning: someone underage is trying to sign up") }
Output: Warning: someone underage is trying to sign up
func (*Validation) Merge ¶
func (validation *Validation) Merge(_validation *Validation) *Validation
Using [Merge](...) you can merge two Validation sessions. When two validations are merged, errors with the same value name will be merged. It is useful for reusing validation logic.
The following example merges the Validation session returned by the validatePreStatus function. Since both Validation sessions validate a value with the name status, the error returned will return two error messages, and without duplicate the Not().Blank() error message rule.
Example ¶
type Record struct { Name string Status string } validatePreStatus := func(status string) *Validation { regex, _ := regexp.Compile("pre-.+") return Check(String(status, "status").Not().Blank().MatchingTo(regex)) } r := Record{"Classified", ""} val := Is( String(r.Name, "name").Not().Blank()).Is( String(r.Status, "status").Not().Blank()) val.Merge(validatePreStatus(r.Status)) if !val.Valid() { out, _ := json.MarshalIndent(val.Error(), "", " ") fmt.Println(string(out)) }
Output: { "status": [ "Status can't be blank", "Status must match to \"pre-.+\"" ] }
func (*Validation) MergeError ¶
func (v *Validation) MergeError(err *Error) *Validation
MergeError allows merging Valgo errors from an already validated Validation session. The function takes an Valgo Error pointer as an argument and returns a Validation pointer.
func (*Validation) MergeErrorIn ¶
func (v *Validation) MergeErrorIn(name string, err *Error) *Validation
MergeErrorIn allows merging Valgo errors from already validated Validation sessions within a map namespace. The function takes a namespace name and an Error pointer as arguments and returns a Validation pointer.
func (*Validation) MergeErrorInRow ¶
func (v *Validation) MergeErrorInRow(name string, index int, err *Error) *Validation
MergeErrorInRow allows merging Valgo errors from already validated Validation sessions within an indexed namespace. The function takes a namespace name, an index, and an Error pointer as arguments and returns a Validation pointer.
func (*Validation) Valid ¶
func (validation *Validation) Valid() bool
A Validation session provides this function which returns either true if all their validators are valid or false if any one of them is invalid.
In the following example, even though the Validator for age is valid, the Validator for status is invalid, making the entire Validator session invalid.
Example ¶
val := Is(Number(21, "age").GreaterThan(18)). Is(String("singl", "status").InSlice([]string{"married", "single"})) if !val.Valid() { out, _ := json.MarshalIndent(val.Error(), "", " ") fmt.Println(string(out)) }
Output: { "status": [ "Status is not valid" ] }
type ValidationFactory ¶
type ValidationFactory struct {
// contains filtered or unexported fields
}
func Factory ¶
func Factory(options FactoryOptions) *ValidationFactory
Factory is a function used to create a Valgo factory.
With a Valgo factory, you can create Validation sessions with preset options, avoiding having to pass options each time when a Validation session is created.
This allows for more flexibility and easier management of options.
The Factory function accepts an options parameter of type FactoryOptions struct, which allows you to specify options such as the default locale code, available locales and a custom JSON marshaler for errors.
func (*ValidationFactory) AddErrorMessage ¶
func (_factory *ValidationFactory) AddErrorMessage(name string, message string) *Validation
Create a new Validation session, through a factory, and add an error message to it without executing a field validator. By adding this error message, the Validation session will be marked as invalid.
func (*ValidationFactory) Check ¶
func (_factory *ValidationFactory) Check(v Validator) *Validation
The Check function, through a factory, is similar to the Is function, however with Check the Rules of the Validator parameter are not short-circuited, which means that regardless of whether a previous rule was valid, all rules are checked.
The function is similar to the [Check()] function, but it uses a factory. For more information see the [Check()] function.
func (*ValidationFactory) In ¶
func (_factory *ValidationFactory) In(name string, v *Validation) *Validation
The In function executes, through a factory, one or more validators in a namespace, so the value names in the error result are prefixed with this namespace. This is useful for validating nested structures.
The function is similar to the [In()] function, but it uses a factory. For more information see the [In()] function.
func (*ValidationFactory) InRow ¶
func (_factory *ValidationFactory) InRow(name string, index int, v *Validation) *Validation
The InRow function executes, through a factory, one or more validators in a namespace similar to the In(...) function, but with indexed namespace. So,\ the value names in the error result are prefixed with this indexed namespace. It is useful for validating nested lists in structures.
The function is similar to the [InRow()] function, but it uses a factory. For more information see the [InRow()] function.
func (*ValidationFactory) Is ¶
func (_factory *ValidationFactory) Is(v Validator) *Validation
The Is function allows you to pass, through a factory, a Validator with the value and the rules for validating it. At the same time, create a Validation session, which lets you add more Validators in order to verify more values.
The function is similar to the [Is()] function, but it uses a factory. For more information see the [Is()] function.
func (*ValidationFactory) New ¶
func (_factory *ValidationFactory) New(options ...Options) *Validation
This New function allows you to create, through a factory, a new Validation session without a Validator. This is useful for conditional validation or reusing validation logic.
The function is similar to the [New()] function, but it uses a factory. For more information see the [New()] function.
type Validator ¶
type Validator interface {
Context() *ValidatorContext
}
Interface implemented by valgo Validators and custom Validators.
type ValidatorAny ¶
type ValidatorAny struct {
// contains filtered or unexported fields
}
The Any validator's type that keeps its validator context.
func Any ¶
func Any(value any, nameAndTitle ...string) *ValidatorAny
Receive a value to validate.
The value can be any type;
Optionally, the function can receive a name and title, in that order, to be displayed in the error messages. A value_%N` pattern is used as a name in the error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name phone_number will be humanized as Phone Number.
func (*ValidatorAny) Context ¶
func (validator *ValidatorAny) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorAny) EqualTo ¶
func (validator *ValidatorAny) EqualTo(value any, template ...string) *ValidatorAny
Validate if a value is equal to another. This function internally uses the golang `==` operator. For example:
status := "running" Is(v.Any(status).Equal("running"))
func (*ValidatorAny) Nil ¶
func (validator *ValidatorAny) Nil(template ...string) *ValidatorAny
Validate if a value is nil. For example:
var status *string Is(v.Any(status).Nil())
func (*ValidatorAny) Not ¶
func (validator *ValidatorAny) Not() *ValidatorAny
Invert the logical value associated with the next validator function. For example:
// It will return false because `Not()` inverts the boolean value associated with the `Equal()` function Is(v.Any("a").Not().Equal("a")).Valid()
func (*ValidatorAny) Passing ¶
func (validator *ValidatorAny) Passing(function func(v any) bool, template ...string) *ValidatorAny
Validate if a value passes a custom function. For example:
status := "" Is(v.Any(status).Passing((v any) bool { return v == getNewStatus() })
type ValidatorBool ¶
type ValidatorBool[T ~bool] struct { // contains filtered or unexported fields }
The Boolean validator type that keeps its validator context.
func Bool ¶
func Bool[T ~bool](value T, nameAndTitle ...string) *ValidatorBool[T]
func (*ValidatorBool[T]) Context ¶
func (validator *ValidatorBool[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorBool[T]) EqualTo ¶
func (validator *ValidatorBool[T]) EqualTo(value T, template ...string) *ValidatorBool[T]
Validate if a boolean value is equal to another. For example:
activated := true Is(v.Bool(activated).Equal(true))
func (*ValidatorBool[T]) False ¶
func (validator *ValidatorBool[T]) False(template ...string) *ValidatorBool[T]
Validate if a boolean value is false. For example:
activated := false Is(v.Bool(activated).Equal(true)).Valid()
func (*ValidatorBool[T]) InSlice ¶
func (validator *ValidatorBool[T]) InSlice(slice []T, template ...string) *ValidatorBool[T]
Validate if the value of a boolean pointer is present in a boolean slice. For example:
activated := false elements := []bool{true, false, true} Is(v.Bool(activated).InSlice(elements))
func (*ValidatorBool[T]) Not ¶
func (validator *ValidatorBool[T]) Not() *ValidatorBool[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because `Not()` inverts the boolean value associated with the True() function Is(v.Bool(true).Not().True()).Valid()
func (*ValidatorBool[T]) Passing ¶
func (validator *ValidatorBool[T]) Passing(function func(v T) bool, template ...string) *ValidatorBool[T]
Validate if a boolean value pass a custom function. For example:
activated := false Is(v.Bool(activated).Passing((v bool) bool { return v == someBoolFunction() })
func (*ValidatorBool[T]) True ¶
func (validator *ValidatorBool[T]) True(template ...string) *ValidatorBool[T]
Validate if a boolean value is true. For example:
activated := true Is(v.Bool(activated).True())
type ValidatorBoolP ¶
type ValidatorBoolP[T ~bool] struct { // contains filtered or unexported fields }
The Boolean pointer validator type that keeps its validator context.
func BoolP ¶
func BoolP[T ~bool](value *T, nameAndTitle ...string) *ValidatorBoolP[T]
Receives a boolean pointer to validate.
The value also can be a custom boolean type such as `type Active bool;`
Optionally, the function can receive a name and title, in that order, to be displayed in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorBoolP[T]) Context ¶
func (validator *ValidatorBoolP[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorBoolP[T]) EqualTo ¶
func (validator *ValidatorBoolP[T]) EqualTo(value T, template ...string) *ValidatorBoolP[T]
Validate if the value of a boolean pointer is equal to another value. For example:
activated := true Is(v.BoolP(&activated).Equal(true))
func (*ValidatorBoolP[T]) False ¶
func (validator *ValidatorBoolP[T]) False(template ...string) *ValidatorBoolP[T]
Validate if the value of a boolean pointer is false. For example:
activated := false Is(v.BoolP(&activated).False())
func (*ValidatorBoolP[T]) FalseOrNil ¶
func (validator *ValidatorBoolP[T]) FalseOrNil(template ...string) *ValidatorBoolP[T]
Validate if the value of a boolean pointer is false or nil. For example:
var activated *bool Is(v.BoolP(activated).FalseOrNil()) *activated = false Is(v.BoolP(activated).FalseOrNil())
func (*ValidatorBoolP[T]) InSlice ¶
func (validator *ValidatorBoolP[T]) InSlice(slice []T, template ...string) *ValidatorBoolP[T]
Validate if the value of a boolean pointer is present in a boolean slice. For example:
activated := false elements := []bool{true, false, true} Is(v.BoolP(&activated).InSlice(elements))
func (*ValidatorBoolP[T]) Nil ¶
func (validator *ValidatorBoolP[T]) Nil(template ...string) *ValidatorBoolP[T]
Validate if a boolean pointer is nil. For example:
var activated *bool Is(v.BoolP(activated).Nil())
func (*ValidatorBoolP[T]) Not ¶
func (validator *ValidatorBoolP[T]) Not() *ValidatorBoolP[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the True() function activated := true Is(v.BoolP(&activated).Not().True()).Valid()
func (*ValidatorBoolP[T]) Passing ¶
func (validator *ValidatorBoolP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorBoolP[T]
Validate if a boolean pointer pass a custom function. For example:
activated := false Is(v.BoolP(&activated).Passing((v *bool) bool { return *v == someBoolFunction() })
func (*ValidatorBoolP[T]) True ¶
func (validator *ValidatorBoolP[T]) True(template ...string) *ValidatorBoolP[T]
Validate if the value of a boolean pointer is true. For example:
activated := true Is(v.BoolP(&activated).True())
type ValidatorByte ¶
type ValidatorByte[T ~byte] struct { // contains filtered or unexported fields }
The byte validator type that keeps its validator context.
func Byte ¶
func Byte[T ~byte](value T, nameAndTitle ...string) *ValidatorByte[T]
func (*ValidatorByte[T]) Between ¶
func (validator *ValidatorByte[T]) Between(min T, max T, template ...string) *ValidatorByte[T]
Validate if the byte is within a range (inclusive). For example:
Is(v.Byte(byte(3)).Between(byte(2),byte(6)))
func (*ValidatorByte[T]) Context ¶
func (validator *ValidatorByte[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorByte[T]) EqualTo ¶
func (validator *ValidatorByte[T]) EqualTo(value T, template ...string) *ValidatorByte[T]
Validate if the byte value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := byte(2) Is(v.Byte(quantity).Equal(byte(2)))
func (*ValidatorByte[T]) GreaterOrEqualTo ¶
func (validator *ValidatorByte[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorByte[T]
Validate if the byte value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := byte(3) Is(v.Byte(quantity).GreaterOrEqualTo(byte(3)))
func (*ValidatorByte[T]) GreaterThan ¶
func (validator *ValidatorByte[T]) GreaterThan(value T, template ...string) *ValidatorByte[T]
Validate if the byte value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := byte(3) Is(v.Byte(quantity).GreaterThan(byte(2)))
func (*ValidatorByte[T]) InSlice ¶
func (validator *ValidatorByte[T]) InSlice(slice []T, template ...string) *ValidatorByte[T]
Validate if the byte value is present in the byte slice. For example:
quantity := byte(3) validQuantities := []byte{1,3,5} Is(v.Byte(quantity).InSlice(validQuantities))
func (*ValidatorByte[T]) LessOrEqualTo ¶
func (validator *ValidatorByte[T]) LessOrEqualTo(value T, template ...string) *ValidatorByte[T]
Validate if the byte value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := byte(2) Is(v.Byte(quantity).LessOrEqualTo(byte(2)))
func (*ValidatorByte[T]) LessThan ¶
func (validator *ValidatorByte[T]) LessThan(value T, template ...string) *ValidatorByte[T]
Validate if the byte value is less than another. This function internally uses the golang `<` operator. For example:
quantity := byte(2) Is(v.Byte(quantity).LessThan(byte(3)))
func (*ValidatorByte[T]) Not ¶
func (validator *ValidatorByte[T]) Not() *ValidatorByte[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Byte(byte(0)).Not().Zero()).Valid()
func (*ValidatorByte[T]) Passing ¶
func (validator *ValidatorByte[T]) Passing(function func(v T) bool, template ...string) *ValidatorByte[T]
Validate if the byte value passes a custom function. For example:
quantity := byte(2) Is(v.Byte(quantity).Passing((v byte) bool { return v == getAllowedQuantity() })
func (*ValidatorByte[T]) Zero ¶
func (validator *ValidatorByte[T]) Zero(template ...string) *ValidatorByte[T]
Validate if the byte value is zero.
For example:
Is(v.Byte(byte(0)).Zero())
type ValidatorByteP ¶
type ValidatorByteP[T ~byte] struct { // contains filtered or unexported fields }
The byte pointer validator type that keeps its validator context.
func ByteP ¶
func ByteP[T ~byte](value *T, nameAndTitle ...string) *ValidatorByteP[T]
Receives the byte pointer to validate.
The value also can be a custom byte type such as `type Level *byte;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorByteP[T]) Between ¶
func (validator *ValidatorByteP[T]) Between(min T, max T, template ...string) *ValidatorByteP[T]
Validate if the value of the byte pointer is within a range (inclusive). For example:
n := byte(3) Is(v.ByteP(&n).Between(byte(2),byte(6)))
func (*ValidatorByteP[T]) Context ¶
func (validator *ValidatorByteP[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorByteP[T]) EqualTo ¶
func (validator *ValidatorByteP[T]) EqualTo(value T, template ...string) *ValidatorByteP[T]
Validate if the byte pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := byte(2) Is(v.ByteP(quantity).Equal(byte(2)))
func (*ValidatorByteP[T]) GreaterOrEqualTo ¶
func (validator *ValidatorByteP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorByteP[T]
Validate if the byte pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := byte(3) Is(v.ByteP(&quantity).GreaterOrEqualTo(byte(3)))
func (*ValidatorByteP[T]) GreaterThan ¶
func (validator *ValidatorByteP[T]) GreaterThan(value T, template ...string) *ValidatorByteP[T]
Validate if the byte pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := byte(3) Is(v.ByteP(&quantity).GreaterThan(byte(2)))
func (*ValidatorByteP[T]) InSlice ¶
func (validator *ValidatorByteP[T]) InSlice(slice []T, template ...string) *ValidatorByteP[T]
Validate if the byte pointer value is present in a numeric slice. For example:
quantity := byte(3) validQuantities := []byte{1,3,5} Is(v.ByteP(&quantity).InSlice(validQuantities))
func (*ValidatorByteP[T]) LessOrEqualTo ¶
func (validator *ValidatorByteP[T]) LessOrEqualTo(value T, template ...string) *ValidatorByteP[T]
Validate if the byte pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := byte(2) Is(v.ByteP(&quantity).LessOrEqualTo(byte(2)))
func (*ValidatorByteP[T]) LessThan ¶
func (validator *ValidatorByteP[T]) LessThan(value T, template ...string) *ValidatorByteP[T]
Validate if the byte pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := byte(2) Is(v.ByteP(&quantity).LessThan(byte(3)))
func (*ValidatorByteP[T]) Nil ¶
func (validator *ValidatorByteP[T]) Nil(template ...string) *ValidatorByteP[T]
Validate if the byte pointer value is nil.
For example:
var quantity *byte Is(v.ByteP(quantity).Nil()) // Will be true
func (*ValidatorByteP[T]) Not ¶
func (validator *ValidatorByteP[T]) Not() *ValidatorByteP[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := byte(0) Is(v.ByteP(&n).Not().Zero()).Valid()
func (*ValidatorByteP[T]) Passing ¶
func (validator *ValidatorByteP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorByteP[T]
Validate if the byte pointer value passes a custom function. For example:
quantity := byte(2) Is(v.ByteP(&quantity).Passing((v *byte) bool { return *v == getAllowedQuantity() })
func (*ValidatorByteP[T]) Zero ¶
func (validator *ValidatorByteP[T]) Zero(template ...string) *ValidatorByteP[T]
Validate if the byte pointer value is zero.
For example:
n := byte(0) Is(v.ByteP(&n).Zero())
func (*ValidatorByteP[T]) ZeroOrNil ¶
func (validator *ValidatorByteP[T]) ZeroOrNil(template ...string) *ValidatorByteP[T]
Validate if the byte pointer value is zero or nil.
For example:
var _quantity *byte Is(v.ByteP(_quantity).ZeroOrNil()) // Will be true
type ValidatorContext ¶
type ValidatorContext struct {
// contains filtered or unexported fields
}
The context keeps the state and provides the functions to control a custom validator.
func NewContext ¶
func NewContext(value any, nameAndTitle ...string) *ValidatorContext
Create a new ValidatorContext to be used by a custom validator.
func (*ValidatorContext) Add ¶
func (ctx *ValidatorContext) Add(function func() bool, errorKey string, template ...string) *ValidatorContext
Add a function to a custom validator.
func (*ValidatorContext) AddWithParams ¶
func (ctx *ValidatorContext) AddWithParams(function func() bool, errorKey string, templateParams map[string]any, template ...string) *ValidatorContext
Add a function to a custom validator and pass a map with values used for the validator function to be displayed in the error message.
func (*ValidatorContext) AddWithValue ¶
func (ctx *ValidatorContext) AddWithValue(function func() bool, errorKey string, value any, template ...string) *ValidatorContext
Add a function to a custom validator and pass a value used for the validator function to be displayed in the error message.
Use [AddWithParams()] if the error message requires more input values.
func (*ValidatorContext) Not ¶
func (ctx *ValidatorContext) Not() *ValidatorContext
Invert the boolean value associated with the next validator function in a custom validator.
func (*ValidatorContext) Value ¶
func (ctx *ValidatorContext) Value() any
Return the value being validated in a custom validator.
type ValidatorFloat32 ¶
type ValidatorFloat32[T ~float32] struct { // contains filtered or unexported fields }
The float32 validator type that keeps its validator context.
func Float32 ¶
func Float32[T ~float32](value T, nameAndTitle ...string) *ValidatorFloat32[T]
func (*ValidatorFloat32[T]) Between ¶
func (validator *ValidatorFloat32[T]) Between(min T, max T, template ...string) *ValidatorFloat32[T]
Validate if the float32 is within a range (inclusive). For example:
Is(v.Float32(float32(3)).Between(float32(2),float32(6)))
func (*ValidatorFloat32[T]) Context ¶
func (validator *ValidatorFloat32[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorFloat32[T]) EqualTo ¶
func (validator *ValidatorFloat32[T]) EqualTo(value T, template ...string) *ValidatorFloat32[T]
Validate if the float32 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := float32(2) Is(v.Float32(quantity).Equal(float32(2)))
func (*ValidatorFloat32[T]) GreaterOrEqualTo ¶
func (validator *ValidatorFloat32[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorFloat32[T]
Validate if the float32 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := float32(3) Is(v.Float32(quantity).GreaterOrEqualTo(float32(3)))
func (*ValidatorFloat32[T]) GreaterThan ¶
func (validator *ValidatorFloat32[T]) GreaterThan(value T, template ...string) *ValidatorFloat32[T]
Validate if the float32 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := float32(3) Is(v.Float32(quantity).GreaterThan(float32(2)))
func (*ValidatorFloat32[T]) InSlice ¶
func (validator *ValidatorFloat32[T]) InSlice(slice []T, template ...string) *ValidatorFloat32[T]
Validate if the float32 value is present in the float32 slice. For example:
quantity := float32(3) validQuantities := []float32{1,3,5} Is(v.Float32(quantity).InSlice(validQuantities))
func (*ValidatorFloat32[T]) LessOrEqualTo ¶
func (validator *ValidatorFloat32[T]) LessOrEqualTo(value T, template ...string) *ValidatorFloat32[T]
Validate if the float32 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := float32(2) Is(v.Float32(quantity).LessOrEqualTo(float32(2)))
func (*ValidatorFloat32[T]) LessThan ¶
func (validator *ValidatorFloat32[T]) LessThan(value T, template ...string) *ValidatorFloat32[T]
Validate if the float32 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := float32(2) Is(v.Float32(quantity).LessThan(float32(3)))
func (*ValidatorFloat32[T]) Not ¶
func (validator *ValidatorFloat32[T]) Not() *ValidatorFloat32[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Float32(float32(0)).Not().Zero()).Valid()
func (*ValidatorFloat32[T]) Passing ¶
func (validator *ValidatorFloat32[T]) Passing(function func(v T) bool, template ...string) *ValidatorFloat32[T]
Validate if the float32 value passes a custom function. For example:
quantity := float32(2) Is(v.Float32(quantity).Passing((v float32) bool { return v == getAllowedQuantity() })
func (*ValidatorFloat32[T]) Zero ¶
func (validator *ValidatorFloat32[T]) Zero(template ...string) *ValidatorFloat32[T]
Validate if the float32 value is zero.
For example:
Is(v.Float32(float32(0)).Zero())
type ValidatorFloat32P ¶
type ValidatorFloat32P[T ~float32] struct { // contains filtered or unexported fields }
The float32 pointer validator type that keeps its validator context.
func Float32P ¶
func Float32P[T ~float32](value *T, nameAndTitle ...string) *ValidatorFloat32P[T]
Receives the float32 pointer to validate.
The value also can be a custom float32 type such as `type Level *float32;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorFloat32P[T]) Between ¶
func (validator *ValidatorFloat32P[T]) Between(min T, max T, template ...string) *ValidatorFloat32P[T]
Validate if the value of the float32 pointer is within a range (inclusive). For example:
n := float32(3) Is(v.Float32P(&n).Between(float32(2),float32(6)))
func (*ValidatorFloat32P[T]) Context ¶
func (validator *ValidatorFloat32P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorFloat32P[T]) EqualTo ¶
func (validator *ValidatorFloat32P[T]) EqualTo(value T, template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := float32(2) Is(v.Float32P(quantity).Equal(float32(2)))
func (*ValidatorFloat32P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorFloat32P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := float32(3) Is(v.Float32P(&quantity).GreaterOrEqualTo(float32(3)))
func (*ValidatorFloat32P[T]) GreaterThan ¶
func (validator *ValidatorFloat32P[T]) GreaterThan(value T, template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := float32(3) Is(v.Float32P(&quantity).GreaterThan(float32(2)))
func (*ValidatorFloat32P[T]) InSlice ¶
func (validator *ValidatorFloat32P[T]) InSlice(slice []T, template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value is present in a numeric slice. For example:
quantity := float32(3) validQuantities := []float32{1,3,5} Is(v.Float32P(&quantity).InSlice(validQuantities))
func (*ValidatorFloat32P[T]) LessOrEqualTo ¶
func (validator *ValidatorFloat32P[T]) LessOrEqualTo(value T, template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := float32(2) Is(v.Float32P(&quantity).LessOrEqualTo(float32(2)))
func (*ValidatorFloat32P[T]) LessThan ¶
func (validator *ValidatorFloat32P[T]) LessThan(value T, template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := float32(2) Is(v.Float32P(&quantity).LessThan(float32(3)))
func (*ValidatorFloat32P[T]) Nil ¶
func (validator *ValidatorFloat32P[T]) Nil(template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value is nil.
For example:
var quantity *float32 Is(v.Float32P(quantity).Nil()) // Will be true
func (*ValidatorFloat32P[T]) Not ¶
func (validator *ValidatorFloat32P[T]) Not() *ValidatorFloat32P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := float32(0) Is(v.Float32P(&n).Not().Zero()).Valid()
func (*ValidatorFloat32P[T]) Passing ¶
func (validator *ValidatorFloat32P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value passes a custom function. For example:
quantity := float32(2) Is(v.Float32P(&quantity).Passing((v *float32) bool { return *v == getAllowedQuantity() })
func (*ValidatorFloat32P[T]) Zero ¶
func (validator *ValidatorFloat32P[T]) Zero(template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value is zero.
For example:
n := float32(0) Is(v.Float32P(&n).Zero())
func (*ValidatorFloat32P[T]) ZeroOrNil ¶
func (validator *ValidatorFloat32P[T]) ZeroOrNil(template ...string) *ValidatorFloat32P[T]
Validate if the float32 pointer value is zero or nil.
For example:
var _quantity *float32 Is(v.Float32P(_quantity).ZeroOrNil()) // Will be true
type ValidatorFloat64 ¶
type ValidatorFloat64[T ~float64] struct { // contains filtered or unexported fields }
The float64 validator type that keeps its validator context.
func Float64 ¶
func Float64[T ~float64](value T, nameAndTitle ...string) *ValidatorFloat64[T]
func (*ValidatorFloat64[T]) Between ¶
func (validator *ValidatorFloat64[T]) Between(min T, max T, template ...string) *ValidatorFloat64[T]
Validate if the float64 is within a range (inclusive). For example:
Is(v.Float64(float64(3)).Between(float64(2),float64(6)))
func (*ValidatorFloat64[T]) Context ¶
func (validator *ValidatorFloat64[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorFloat64[T]) EqualTo ¶
func (validator *ValidatorFloat64[T]) EqualTo(value T, template ...string) *ValidatorFloat64[T]
Validate if the float64 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := float64(2) Is(v.Float64(quantity).Equal(float64(2)))
func (*ValidatorFloat64[T]) GreaterOrEqualTo ¶
func (validator *ValidatorFloat64[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorFloat64[T]
Validate if the float64 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := float64(3) Is(v.Float64(quantity).GreaterOrEqualTo(float64(3)))
func (*ValidatorFloat64[T]) GreaterThan ¶
func (validator *ValidatorFloat64[T]) GreaterThan(value T, template ...string) *ValidatorFloat64[T]
Validate if the float64 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := float64(3) Is(v.Float64(quantity).GreaterThan(float64(2)))
func (*ValidatorFloat64[T]) InSlice ¶
func (validator *ValidatorFloat64[T]) InSlice(slice []T, template ...string) *ValidatorFloat64[T]
Validate if the float64 value is present in the float64 slice. For example:
quantity := float64(3) validQuantities := []float64{1,3,5} Is(v.Float64(quantity).InSlice(validQuantities))
func (*ValidatorFloat64[T]) LessOrEqualTo ¶
func (validator *ValidatorFloat64[T]) LessOrEqualTo(value T, template ...string) *ValidatorFloat64[T]
Validate if the float64 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := float64(2) Is(v.Float64(quantity).LessOrEqualTo(float64(2)))
func (*ValidatorFloat64[T]) LessThan ¶
func (validator *ValidatorFloat64[T]) LessThan(value T, template ...string) *ValidatorFloat64[T]
Validate if the float64 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := float64(2) Is(v.Float64(quantity).LessThan(float64(3)))
func (*ValidatorFloat64[T]) Not ¶
func (validator *ValidatorFloat64[T]) Not() *ValidatorFloat64[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Float64(float64(0)).Not().Zero()).Valid()
func (*ValidatorFloat64[T]) Passing ¶
func (validator *ValidatorFloat64[T]) Passing(function func(v T) bool, template ...string) *ValidatorFloat64[T]
Validate if the float64 value passes a custom function. For example:
quantity := float64(2) Is(v.Float64(quantity).Passing((v float64) bool { return v == getAllowedQuantity() })
func (*ValidatorFloat64[T]) Zero ¶
func (validator *ValidatorFloat64[T]) Zero(template ...string) *ValidatorFloat64[T]
Validate if the float64 value is zero.
For example:
Is(v.Float64(float64(0)).Zero())
type ValidatorFloat64P ¶
type ValidatorFloat64P[T ~float64] struct { // contains filtered or unexported fields }
The float64 pointer validator type that keeps its validator context.
func Float64P ¶
func Float64P[T ~float64](value *T, nameAndTitle ...string) *ValidatorFloat64P[T]
Receives the float64 pointer to validate.
The value also can be a custom float64 type such as `type Level *float64;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorFloat64P[T]) Between ¶
func (validator *ValidatorFloat64P[T]) Between(min T, max T, template ...string) *ValidatorFloat64P[T]
Validate if the value of the float64 pointer is within a range (inclusive). For example:
n := float64(3) Is(v.Float64P(&n).Between(float64(2),float64(6)))
func (*ValidatorFloat64P[T]) Context ¶
func (validator *ValidatorFloat64P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorFloat64P[T]) EqualTo ¶
func (validator *ValidatorFloat64P[T]) EqualTo(value T, template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := float64(2) Is(v.Float64P(quantity).Equal(float64(2)))
func (*ValidatorFloat64P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorFloat64P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := float64(3) Is(v.Float64P(&quantity).GreaterOrEqualTo(float64(3)))
func (*ValidatorFloat64P[T]) GreaterThan ¶
func (validator *ValidatorFloat64P[T]) GreaterThan(value T, template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := float64(3) Is(v.Float64P(&quantity).GreaterThan(float64(2)))
func (*ValidatorFloat64P[T]) InSlice ¶
func (validator *ValidatorFloat64P[T]) InSlice(slice []T, template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value is present in a numeric slice. For example:
quantity := float64(3) validQuantities := []float64{1,3,5} Is(v.Float64P(&quantity).InSlice(validQuantities))
func (*ValidatorFloat64P[T]) LessOrEqualTo ¶
func (validator *ValidatorFloat64P[T]) LessOrEqualTo(value T, template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := float64(2) Is(v.Float64P(&quantity).LessOrEqualTo(float64(2)))
func (*ValidatorFloat64P[T]) LessThan ¶
func (validator *ValidatorFloat64P[T]) LessThan(value T, template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := float64(2) Is(v.Float64P(&quantity).LessThan(float64(3)))
func (*ValidatorFloat64P[T]) Nil ¶
func (validator *ValidatorFloat64P[T]) Nil(template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value is nil.
For example:
var quantity *float64 Is(v.Float64P(quantity).Nil()) // Will be true
func (*ValidatorFloat64P[T]) Not ¶
func (validator *ValidatorFloat64P[T]) Not() *ValidatorFloat64P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := float64(0) Is(v.Float64P(&n).Not().Zero()).Valid()
func (*ValidatorFloat64P[T]) Passing ¶
func (validator *ValidatorFloat64P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value passes a custom function. For example:
quantity := float64(2) Is(v.Float64P(&quantity).Passing((v *float64) bool { return *v == getAllowedQuantity() })
func (*ValidatorFloat64P[T]) Zero ¶
func (validator *ValidatorFloat64P[T]) Zero(template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value is zero.
For example:
n := float64(0) Is(v.Float64P(&n).Zero())
func (*ValidatorFloat64P[T]) ZeroOrNil ¶
func (validator *ValidatorFloat64P[T]) ZeroOrNil(template ...string) *ValidatorFloat64P[T]
Validate if the float64 pointer value is zero or nil.
For example:
var _quantity *float64 Is(v.Float64P(_quantity).ZeroOrNil()) // Will be true
type ValidatorInt ¶
type ValidatorInt[T ~int] struct { // contains filtered or unexported fields }
The int validator type that keeps its validator context.
func Int ¶
func Int[T ~int](value T, nameAndTitle ...string) *ValidatorInt[T]
func (*ValidatorInt[T]) Between ¶
func (validator *ValidatorInt[T]) Between(min T, max T, template ...string) *ValidatorInt[T]
Validate if the int is within a range (inclusive). For example:
Is(v.Int(int(3)).Between(int(2),int(6)))
func (*ValidatorInt[T]) Context ¶
func (validator *ValidatorInt[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorInt[T]) EqualTo ¶
func (validator *ValidatorInt[T]) EqualTo(value T, template ...string) *ValidatorInt[T]
Validate if the int value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := int(2) Is(v.Int(quantity).Equal(int(2)))
func (*ValidatorInt[T]) GreaterOrEqualTo ¶
func (validator *ValidatorInt[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt[T]
Validate if the int value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := int(3) Is(v.Int(quantity).GreaterOrEqualTo(int(3)))
func (*ValidatorInt[T]) GreaterThan ¶
func (validator *ValidatorInt[T]) GreaterThan(value T, template ...string) *ValidatorInt[T]
Validate if the int value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := int(3) Is(v.Int(quantity).GreaterThan(int(2)))
func (*ValidatorInt[T]) InSlice ¶
func (validator *ValidatorInt[T]) InSlice(slice []T, template ...string) *ValidatorInt[T]
Validate if the int value is present in the int slice. For example:
quantity := int(3) validQuantities := []int{1,3,5} Is(v.Int(quantity).InSlice(validQuantities))
func (*ValidatorInt[T]) LessOrEqualTo ¶
func (validator *ValidatorInt[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt[T]
Validate if the int value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := int(2) Is(v.Int(quantity).LessOrEqualTo(int(2)))
func (*ValidatorInt[T]) LessThan ¶
func (validator *ValidatorInt[T]) LessThan(value T, template ...string) *ValidatorInt[T]
Validate if the int value is less than another. This function internally uses the golang `<` operator. For example:
quantity := int(2) Is(v.Int(quantity).LessThan(int(3)))
func (*ValidatorInt[T]) Not ¶
func (validator *ValidatorInt[T]) Not() *ValidatorInt[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Int(int(0)).Not().Zero()).Valid()
func (*ValidatorInt[T]) Passing ¶
func (validator *ValidatorInt[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt[T]
Validate if the int value passes a custom function. For example:
quantity := int(2) Is(v.Int(quantity).Passing((v int) bool { return v == getAllowedQuantity() })
func (*ValidatorInt[T]) Zero ¶
func (validator *ValidatorInt[T]) Zero(template ...string) *ValidatorInt[T]
Validate if the int value is zero.
For example:
Is(v.Int(int(0)).Zero())
type ValidatorInt16 ¶
type ValidatorInt16[T ~int16] struct { // contains filtered or unexported fields }
The int16 validator type that keeps its validator context.
func Int16 ¶
func Int16[T ~int16](value T, nameAndTitle ...string) *ValidatorInt16[T]
func (*ValidatorInt16[T]) Between ¶
func (validator *ValidatorInt16[T]) Between(min T, max T, template ...string) *ValidatorInt16[T]
Validate if the int16 is within a range (inclusive). For example:
Is(v.Int16(int16(3)).Between(int16(2),int16(6)))
func (*ValidatorInt16[T]) Context ¶
func (validator *ValidatorInt16[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorInt16[T]) EqualTo ¶
func (validator *ValidatorInt16[T]) EqualTo(value T, template ...string) *ValidatorInt16[T]
Validate if the int16 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := int16(2) Is(v.Int16(quantity).Equal(int16(2)))
func (*ValidatorInt16[T]) GreaterOrEqualTo ¶
func (validator *ValidatorInt16[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt16[T]
Validate if the int16 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := int16(3) Is(v.Int16(quantity).GreaterOrEqualTo(int16(3)))
func (*ValidatorInt16[T]) GreaterThan ¶
func (validator *ValidatorInt16[T]) GreaterThan(value T, template ...string) *ValidatorInt16[T]
Validate if the int16 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := int16(3) Is(v.Int16(quantity).GreaterThan(int16(2)))
func (*ValidatorInt16[T]) InSlice ¶
func (validator *ValidatorInt16[T]) InSlice(slice []T, template ...string) *ValidatorInt16[T]
Validate if the int16 value is present in the int16 slice. For example:
quantity := int16(3) validQuantities := []int16{1,3,5} Is(v.Int16(quantity).InSlice(validQuantities))
func (*ValidatorInt16[T]) LessOrEqualTo ¶
func (validator *ValidatorInt16[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt16[T]
Validate if the int16 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := int16(2) Is(v.Int16(quantity).LessOrEqualTo(int16(2)))
func (*ValidatorInt16[T]) LessThan ¶
func (validator *ValidatorInt16[T]) LessThan(value T, template ...string) *ValidatorInt16[T]
Validate if the int16 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := int16(2) Is(v.Int16(quantity).LessThan(int16(3)))
func (*ValidatorInt16[T]) Not ¶
func (validator *ValidatorInt16[T]) Not() *ValidatorInt16[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Int16(int16(0)).Not().Zero()).Valid()
func (*ValidatorInt16[T]) Passing ¶
func (validator *ValidatorInt16[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt16[T]
Validate if the int16 value passes a custom function. For example:
quantity := int16(2) Is(v.Int16(quantity).Passing((v int16) bool { return v == getAllowedQuantity() })
func (*ValidatorInt16[T]) Zero ¶
func (validator *ValidatorInt16[T]) Zero(template ...string) *ValidatorInt16[T]
Validate if the int16 value is zero.
For example:
Is(v.Int16(int16(0)).Zero())
type ValidatorInt16P ¶
type ValidatorInt16P[T ~int16] struct { // contains filtered or unexported fields }
The int16 pointer validator type that keeps its validator context.
func Int16P ¶
func Int16P[T ~int16](value *T, nameAndTitle ...string) *ValidatorInt16P[T]
Receives the int16 pointer to validate.
The value also can be a custom int16 type such as `type Level *int16;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorInt16P[T]) Between ¶
func (validator *ValidatorInt16P[T]) Between(min T, max T, template ...string) *ValidatorInt16P[T]
Validate if the value of the int16 pointer is within a range (inclusive). For example:
n := int16(3) Is(v.Int16P(&n).Between(int16(2),int16(6)))
func (*ValidatorInt16P[T]) Context ¶
func (validator *ValidatorInt16P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorInt16P[T]) EqualTo ¶
func (validator *ValidatorInt16P[T]) EqualTo(value T, template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := int16(2) Is(v.Int16P(quantity).Equal(int16(2)))
func (*ValidatorInt16P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorInt16P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := int16(3) Is(v.Int16P(&quantity).GreaterOrEqualTo(int16(3)))
func (*ValidatorInt16P[T]) GreaterThan ¶
func (validator *ValidatorInt16P[T]) GreaterThan(value T, template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := int16(3) Is(v.Int16P(&quantity).GreaterThan(int16(2)))
func (*ValidatorInt16P[T]) InSlice ¶
func (validator *ValidatorInt16P[T]) InSlice(slice []T, template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value is present in a numeric slice. For example:
quantity := int16(3) validQuantities := []int16{1,3,5} Is(v.Int16P(&quantity).InSlice(validQuantities))
func (*ValidatorInt16P[T]) LessOrEqualTo ¶
func (validator *ValidatorInt16P[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := int16(2) Is(v.Int16P(&quantity).LessOrEqualTo(int16(2)))
func (*ValidatorInt16P[T]) LessThan ¶
func (validator *ValidatorInt16P[T]) LessThan(value T, template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := int16(2) Is(v.Int16P(&quantity).LessThan(int16(3)))
func (*ValidatorInt16P[T]) Nil ¶
func (validator *ValidatorInt16P[T]) Nil(template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value is nil.
For example:
var quantity *int16 Is(v.Int16P(quantity).Nil()) // Will be true
func (*ValidatorInt16P[T]) Not ¶
func (validator *ValidatorInt16P[T]) Not() *ValidatorInt16P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := int16(0) Is(v.Int16P(&n).Not().Zero()).Valid()
func (*ValidatorInt16P[T]) Passing ¶
func (validator *ValidatorInt16P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value passes a custom function. For example:
quantity := int16(2) Is(v.Int16P(&quantity).Passing((v *int16) bool { return *v == getAllowedQuantity() })
func (*ValidatorInt16P[T]) Zero ¶
func (validator *ValidatorInt16P[T]) Zero(template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value is zero.
For example:
n := int16(0) Is(v.Int16P(&n).Zero())
func (*ValidatorInt16P[T]) ZeroOrNil ¶
func (validator *ValidatorInt16P[T]) ZeroOrNil(template ...string) *ValidatorInt16P[T]
Validate if the int16 pointer value is zero or nil.
For example:
var _quantity *int16 Is(v.Int16P(_quantity).ZeroOrNil()) // Will be true
type ValidatorInt32 ¶
type ValidatorInt32[T ~int32] struct { // contains filtered or unexported fields }
The int32 validator type that keeps its validator context.
func Int32 ¶
func Int32[T ~int32](value T, nameAndTitle ...string) *ValidatorInt32[T]
func (*ValidatorInt32[T]) Between ¶
func (validator *ValidatorInt32[T]) Between(min T, max T, template ...string) *ValidatorInt32[T]
Validate if the int32 is within a range (inclusive). For example:
Is(v.Int32(int32(3)).Between(int32(2),int32(6)))
func (*ValidatorInt32[T]) Context ¶
func (validator *ValidatorInt32[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorInt32[T]) EqualTo ¶
func (validator *ValidatorInt32[T]) EqualTo(value T, template ...string) *ValidatorInt32[T]
Validate if the int32 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := int32(2) Is(v.Int32(quantity).Equal(int32(2)))
func (*ValidatorInt32[T]) GreaterOrEqualTo ¶
func (validator *ValidatorInt32[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt32[T]
Validate if the int32 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := int32(3) Is(v.Int32(quantity).GreaterOrEqualTo(int32(3)))
func (*ValidatorInt32[T]) GreaterThan ¶
func (validator *ValidatorInt32[T]) GreaterThan(value T, template ...string) *ValidatorInt32[T]
Validate if the int32 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := int32(3) Is(v.Int32(quantity).GreaterThan(int32(2)))
func (*ValidatorInt32[T]) InSlice ¶
func (validator *ValidatorInt32[T]) InSlice(slice []T, template ...string) *ValidatorInt32[T]
Validate if the int32 value is present in the int32 slice. For example:
quantity := int32(3) validQuantities := []int32{1,3,5} Is(v.Int32(quantity).InSlice(validQuantities))
func (*ValidatorInt32[T]) LessOrEqualTo ¶
func (validator *ValidatorInt32[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt32[T]
Validate if the int32 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := int32(2) Is(v.Int32(quantity).LessOrEqualTo(int32(2)))
func (*ValidatorInt32[T]) LessThan ¶
func (validator *ValidatorInt32[T]) LessThan(value T, template ...string) *ValidatorInt32[T]
Validate if the int32 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := int32(2) Is(v.Int32(quantity).LessThan(int32(3)))
func (*ValidatorInt32[T]) Not ¶
func (validator *ValidatorInt32[T]) Not() *ValidatorInt32[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Int32(int32(0)).Not().Zero()).Valid()
func (*ValidatorInt32[T]) Passing ¶
func (validator *ValidatorInt32[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt32[T]
Validate if the int32 value passes a custom function. For example:
quantity := int32(2) Is(v.Int32(quantity).Passing((v int32) bool { return v == getAllowedQuantity() })
func (*ValidatorInt32[T]) Zero ¶
func (validator *ValidatorInt32[T]) Zero(template ...string) *ValidatorInt32[T]
Validate if the int32 value is zero.
For example:
Is(v.Int32(int32(0)).Zero())
type ValidatorInt32P ¶
type ValidatorInt32P[T ~int32] struct { // contains filtered or unexported fields }
The int32 pointer validator type that keeps its validator context.
func Int32P ¶
func Int32P[T ~int32](value *T, nameAndTitle ...string) *ValidatorInt32P[T]
Receives the int32 pointer to validate.
The value also can be a custom int32 type such as `type Level *int32;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorInt32P[T]) Between ¶
func (validator *ValidatorInt32P[T]) Between(min T, max T, template ...string) *ValidatorInt32P[T]
Validate if the value of the int32 pointer is within a range (inclusive). For example:
n := int32(3) Is(v.Int32P(&n).Between(int32(2),int32(6)))
func (*ValidatorInt32P[T]) Context ¶
func (validator *ValidatorInt32P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorInt32P[T]) EqualTo ¶
func (validator *ValidatorInt32P[T]) EqualTo(value T, template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := int32(2) Is(v.Int32P(quantity).Equal(int32(2)))
func (*ValidatorInt32P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorInt32P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := int32(3) Is(v.Int32P(&quantity).GreaterOrEqualTo(int32(3)))
func (*ValidatorInt32P[T]) GreaterThan ¶
func (validator *ValidatorInt32P[T]) GreaterThan(value T, template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := int32(3) Is(v.Int32P(&quantity).GreaterThan(int32(2)))
func (*ValidatorInt32P[T]) InSlice ¶
func (validator *ValidatorInt32P[T]) InSlice(slice []T, template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value is present in a numeric slice. For example:
quantity := int32(3) validQuantities := []int32{1,3,5} Is(v.Int32P(&quantity).InSlice(validQuantities))
func (*ValidatorInt32P[T]) LessOrEqualTo ¶
func (validator *ValidatorInt32P[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := int32(2) Is(v.Int32P(&quantity).LessOrEqualTo(int32(2)))
func (*ValidatorInt32P[T]) LessThan ¶
func (validator *ValidatorInt32P[T]) LessThan(value T, template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := int32(2) Is(v.Int32P(&quantity).LessThan(int32(3)))
func (*ValidatorInt32P[T]) Nil ¶
func (validator *ValidatorInt32P[T]) Nil(template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value is nil.
For example:
var quantity *int32 Is(v.Int32P(quantity).Nil()) // Will be true
func (*ValidatorInt32P[T]) Not ¶
func (validator *ValidatorInt32P[T]) Not() *ValidatorInt32P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := int32(0) Is(v.Int32P(&n).Not().Zero()).Valid()
func (*ValidatorInt32P[T]) Passing ¶
func (validator *ValidatorInt32P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value passes a custom function. For example:
quantity := int32(2) Is(v.Int32P(&quantity).Passing((v *int32) bool { return *v == getAllowedQuantity() })
func (*ValidatorInt32P[T]) Zero ¶
func (validator *ValidatorInt32P[T]) Zero(template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value is zero.
For example:
n := int32(0) Is(v.Int32P(&n).Zero())
func (*ValidatorInt32P[T]) ZeroOrNil ¶
func (validator *ValidatorInt32P[T]) ZeroOrNil(template ...string) *ValidatorInt32P[T]
Validate if the int32 pointer value is zero or nil.
For example:
var _quantity *int32 Is(v.Int32P(_quantity).ZeroOrNil()) // Will be true
type ValidatorInt64 ¶
type ValidatorInt64[T ~int64] struct { // contains filtered or unexported fields }
The int64 validator type that keeps its validator context.
func Int64 ¶
func Int64[T ~int64](value T, nameAndTitle ...string) *ValidatorInt64[T]
func (*ValidatorInt64[T]) Between ¶
func (validator *ValidatorInt64[T]) Between(min T, max T, template ...string) *ValidatorInt64[T]
Validate if the int64 is within a range (inclusive). For example:
Is(v.Int64(int64(3)).Between(int64(2),int64(6)))
func (*ValidatorInt64[T]) Context ¶
func (validator *ValidatorInt64[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorInt64[T]) EqualTo ¶
func (validator *ValidatorInt64[T]) EqualTo(value T, template ...string) *ValidatorInt64[T]
Validate if the int64 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := int64(2) Is(v.Int64(quantity).Equal(int64(2)))
func (*ValidatorInt64[T]) GreaterOrEqualTo ¶
func (validator *ValidatorInt64[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt64[T]
Validate if the int64 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := int64(3) Is(v.Int64(quantity).GreaterOrEqualTo(int64(3)))
func (*ValidatorInt64[T]) GreaterThan ¶
func (validator *ValidatorInt64[T]) GreaterThan(value T, template ...string) *ValidatorInt64[T]
Validate if the int64 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := int64(3) Is(v.Int64(quantity).GreaterThan(int64(2)))
func (*ValidatorInt64[T]) InSlice ¶
func (validator *ValidatorInt64[T]) InSlice(slice []T, template ...string) *ValidatorInt64[T]
Validate if the int64 value is present in the int64 slice. For example:
quantity := int64(3) validQuantities := []int64{1,3,5} Is(v.Int64(quantity).InSlice(validQuantities))
func (*ValidatorInt64[T]) LessOrEqualTo ¶
func (validator *ValidatorInt64[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt64[T]
Validate if the int64 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := int64(2) Is(v.Int64(quantity).LessOrEqualTo(int64(2)))
func (*ValidatorInt64[T]) LessThan ¶
func (validator *ValidatorInt64[T]) LessThan(value T, template ...string) *ValidatorInt64[T]
Validate if the int64 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := int64(2) Is(v.Int64(quantity).LessThan(int64(3)))
func (*ValidatorInt64[T]) Not ¶
func (validator *ValidatorInt64[T]) Not() *ValidatorInt64[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Int64(int64(0)).Not().Zero()).Valid()
func (*ValidatorInt64[T]) Passing ¶
func (validator *ValidatorInt64[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt64[T]
Validate if the int64 value passes a custom function. For example:
quantity := int64(2) Is(v.Int64(quantity).Passing((v int64) bool { return v == getAllowedQuantity() })
func (*ValidatorInt64[T]) Zero ¶
func (validator *ValidatorInt64[T]) Zero(template ...string) *ValidatorInt64[T]
Validate if the int64 value is zero.
For example:
Is(v.Int64(int64(0)).Zero())
type ValidatorInt64P ¶
type ValidatorInt64P[T ~int64] struct { // contains filtered or unexported fields }
The int64 pointer validator type that keeps its validator context.
func Int64P ¶
func Int64P[T ~int64](value *T, nameAndTitle ...string) *ValidatorInt64P[T]
Receives the int64 pointer to validate.
The value also can be a custom int64 type such as `type Level *int64;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorInt64P[T]) Between ¶
func (validator *ValidatorInt64P[T]) Between(min T, max T, template ...string) *ValidatorInt64P[T]
Validate if the value of the int64 pointer is within a range (inclusive). For example:
n := int64(3) Is(v.Int64P(&n).Between(int64(2),int64(6)))
func (*ValidatorInt64P[T]) Context ¶
func (validator *ValidatorInt64P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorInt64P[T]) EqualTo ¶
func (validator *ValidatorInt64P[T]) EqualTo(value T, template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := int64(2) Is(v.Int64P(quantity).Equal(int64(2)))
func (*ValidatorInt64P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorInt64P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := int64(3) Is(v.Int64P(&quantity).GreaterOrEqualTo(int64(3)))
func (*ValidatorInt64P[T]) GreaterThan ¶
func (validator *ValidatorInt64P[T]) GreaterThan(value T, template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := int64(3) Is(v.Int64P(&quantity).GreaterThan(int64(2)))
func (*ValidatorInt64P[T]) InSlice ¶
func (validator *ValidatorInt64P[T]) InSlice(slice []T, template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value is present in a numeric slice. For example:
quantity := int64(3) validQuantities := []int64{1,3,5} Is(v.Int64P(&quantity).InSlice(validQuantities))
func (*ValidatorInt64P[T]) LessOrEqualTo ¶
func (validator *ValidatorInt64P[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := int64(2) Is(v.Int64P(&quantity).LessOrEqualTo(int64(2)))
func (*ValidatorInt64P[T]) LessThan ¶
func (validator *ValidatorInt64P[T]) LessThan(value T, template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := int64(2) Is(v.Int64P(&quantity).LessThan(int64(3)))
func (*ValidatorInt64P[T]) Nil ¶
func (validator *ValidatorInt64P[T]) Nil(template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value is nil.
For example:
var quantity *int64 Is(v.Int64P(quantity).Nil()) // Will be true
func (*ValidatorInt64P[T]) Not ¶
func (validator *ValidatorInt64P[T]) Not() *ValidatorInt64P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := int64(0) Is(v.Int64P(&n).Not().Zero()).Valid()
func (*ValidatorInt64P[T]) Passing ¶
func (validator *ValidatorInt64P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value passes a custom function. For example:
quantity := int64(2) Is(v.Int64P(&quantity).Passing((v *int64) bool { return *v == getAllowedQuantity() })
func (*ValidatorInt64P[T]) Zero ¶
func (validator *ValidatorInt64P[T]) Zero(template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value is zero.
For example:
n := int64(0) Is(v.Int64P(&n).Zero())
func (*ValidatorInt64P[T]) ZeroOrNil ¶
func (validator *ValidatorInt64P[T]) ZeroOrNil(template ...string) *ValidatorInt64P[T]
Validate if the int64 pointer value is zero or nil.
For example:
var _quantity *int64 Is(v.Int64P(_quantity).ZeroOrNil()) // Will be true
type ValidatorInt8 ¶
type ValidatorInt8[T ~int8] struct { // contains filtered or unexported fields }
The int8 validator type that keeps its validator context.
func Int8 ¶
func Int8[T ~int8](value T, nameAndTitle ...string) *ValidatorInt8[T]
func (*ValidatorInt8[T]) Between ¶
func (validator *ValidatorInt8[T]) Between(min T, max T, template ...string) *ValidatorInt8[T]
Validate if the int8 is within a range (inclusive). For example:
Is(v.Int8(int8(3)).Between(int8(2),int8(6)))
func (*ValidatorInt8[T]) Context ¶
func (validator *ValidatorInt8[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorInt8[T]) EqualTo ¶
func (validator *ValidatorInt8[T]) EqualTo(value T, template ...string) *ValidatorInt8[T]
Validate if the int8 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := int8(2) Is(v.Int8(quantity).Equal(int8(2)))
func (*ValidatorInt8[T]) GreaterOrEqualTo ¶
func (validator *ValidatorInt8[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt8[T]
Validate if the int8 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := int8(3) Is(v.Int8(quantity).GreaterOrEqualTo(int8(3)))
func (*ValidatorInt8[T]) GreaterThan ¶
func (validator *ValidatorInt8[T]) GreaterThan(value T, template ...string) *ValidatorInt8[T]
Validate if the int8 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := int8(3) Is(v.Int8(quantity).GreaterThan(int8(2)))
func (*ValidatorInt8[T]) InSlice ¶
func (validator *ValidatorInt8[T]) InSlice(slice []T, template ...string) *ValidatorInt8[T]
Validate if the int8 value is present in the int8 slice. For example:
quantity := int8(3) validQuantities := []int8{1,3,5} Is(v.Int8(quantity).InSlice(validQuantities))
func (*ValidatorInt8[T]) LessOrEqualTo ¶
func (validator *ValidatorInt8[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt8[T]
Validate if the int8 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := int8(2) Is(v.Int8(quantity).LessOrEqualTo(int8(2)))
func (*ValidatorInt8[T]) LessThan ¶
func (validator *ValidatorInt8[T]) LessThan(value T, template ...string) *ValidatorInt8[T]
Validate if the int8 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := int8(2) Is(v.Int8(quantity).LessThan(int8(3)))
func (*ValidatorInt8[T]) Not ¶
func (validator *ValidatorInt8[T]) Not() *ValidatorInt8[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Int8(int8(0)).Not().Zero()).Valid()
func (*ValidatorInt8[T]) Passing ¶
func (validator *ValidatorInt8[T]) Passing(function func(v T) bool, template ...string) *ValidatorInt8[T]
Validate if the int8 value passes a custom function. For example:
quantity := int8(2) Is(v.Int8(quantity).Passing((v int8) bool { return v == getAllowedQuantity() })
func (*ValidatorInt8[T]) Zero ¶
func (validator *ValidatorInt8[T]) Zero(template ...string) *ValidatorInt8[T]
Validate if the int8 value is zero.
For example:
Is(v.Int8(int8(0)).Zero())
type ValidatorInt8P ¶
type ValidatorInt8P[T ~int8] struct { // contains filtered or unexported fields }
The int8 pointer validator type that keeps its validator context.
func Int8P ¶
func Int8P[T ~int8](value *T, nameAndTitle ...string) *ValidatorInt8P[T]
Receives the int8 pointer to validate.
The value also can be a custom int8 type such as `type Level *int8;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorInt8P[T]) Between ¶
func (validator *ValidatorInt8P[T]) Between(min T, max T, template ...string) *ValidatorInt8P[T]
Validate if the value of the int8 pointer is within a range (inclusive). For example:
n := int8(3) Is(v.Int8P(&n).Between(int8(2),int8(6)))
func (*ValidatorInt8P[T]) Context ¶
func (validator *ValidatorInt8P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorInt8P[T]) EqualTo ¶
func (validator *ValidatorInt8P[T]) EqualTo(value T, template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := int8(2) Is(v.Int8P(quantity).Equal(int8(2)))
func (*ValidatorInt8P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorInt8P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := int8(3) Is(v.Int8P(&quantity).GreaterOrEqualTo(int8(3)))
func (*ValidatorInt8P[T]) GreaterThan ¶
func (validator *ValidatorInt8P[T]) GreaterThan(value T, template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := int8(3) Is(v.Int8P(&quantity).GreaterThan(int8(2)))
func (*ValidatorInt8P[T]) InSlice ¶
func (validator *ValidatorInt8P[T]) InSlice(slice []T, template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value is present in a numeric slice. For example:
quantity := int8(3) validQuantities := []int8{1,3,5} Is(v.Int8P(&quantity).InSlice(validQuantities))
func (*ValidatorInt8P[T]) LessOrEqualTo ¶
func (validator *ValidatorInt8P[T]) LessOrEqualTo(value T, template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := int8(2) Is(v.Int8P(&quantity).LessOrEqualTo(int8(2)))
func (*ValidatorInt8P[T]) LessThan ¶
func (validator *ValidatorInt8P[T]) LessThan(value T, template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := int8(2) Is(v.Int8P(&quantity).LessThan(int8(3)))
func (*ValidatorInt8P[T]) Nil ¶
func (validator *ValidatorInt8P[T]) Nil(template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value is nil.
For example:
var quantity *int8 Is(v.Int8P(quantity).Nil()) // Will be true
func (*ValidatorInt8P[T]) Not ¶
func (validator *ValidatorInt8P[T]) Not() *ValidatorInt8P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := int8(0) Is(v.Int8P(&n).Not().Zero()).Valid()
func (*ValidatorInt8P[T]) Passing ¶
func (validator *ValidatorInt8P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value passes a custom function. For example:
quantity := int8(2) Is(v.Int8P(&quantity).Passing((v *int8) bool { return *v == getAllowedQuantity() })
func (*ValidatorInt8P[T]) Zero ¶
func (validator *ValidatorInt8P[T]) Zero(template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value is zero.
For example:
n := int8(0) Is(v.Int8P(&n).Zero())
func (*ValidatorInt8P[T]) ZeroOrNil ¶
func (validator *ValidatorInt8P[T]) ZeroOrNil(template ...string) *ValidatorInt8P[T]
Validate if the int8 pointer value is zero or nil.
For example:
var _quantity *int8 Is(v.Int8P(_quantity).ZeroOrNil()) // Will be true
type ValidatorIntP ¶
type ValidatorIntP[T ~int] struct { // contains filtered or unexported fields }
The int pointer validator type that keeps its validator context.
func IntP ¶
func IntP[T ~int](value *T, nameAndTitle ...string) *ValidatorIntP[T]
Receives the int pointer to validate.
The value also can be a custom int type such as `type Level *int;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorIntP[T]) Between ¶
func (validator *ValidatorIntP[T]) Between(min T, max T, template ...string) *ValidatorIntP[T]
Validate if the value of the int pointer is within a range (inclusive). For example:
n := int(3) Is(v.IntP(&n).Between(int(2),int(6)))
func (*ValidatorIntP[T]) Context ¶
func (validator *ValidatorIntP[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorIntP[T]) EqualTo ¶
func (validator *ValidatorIntP[T]) EqualTo(value T, template ...string) *ValidatorIntP[T]
Validate if the int pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := int(2) Is(v.IntP(quantity).Equal(int(2)))
func (*ValidatorIntP[T]) GreaterOrEqualTo ¶
func (validator *ValidatorIntP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorIntP[T]
Validate if the int pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := int(3) Is(v.IntP(&quantity).GreaterOrEqualTo(int(3)))
func (*ValidatorIntP[T]) GreaterThan ¶
func (validator *ValidatorIntP[T]) GreaterThan(value T, template ...string) *ValidatorIntP[T]
Validate if the int pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := int(3) Is(v.IntP(&quantity).GreaterThan(int(2)))
func (*ValidatorIntP[T]) InSlice ¶
func (validator *ValidatorIntP[T]) InSlice(slice []T, template ...string) *ValidatorIntP[T]
Validate if the int pointer value is present in a numeric slice. For example:
quantity := int(3) validQuantities := []int{1,3,5} Is(v.IntP(&quantity).InSlice(validQuantities))
func (*ValidatorIntP[T]) LessOrEqualTo ¶
func (validator *ValidatorIntP[T]) LessOrEqualTo(value T, template ...string) *ValidatorIntP[T]
Validate if the int pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := int(2) Is(v.IntP(&quantity).LessOrEqualTo(int(2)))
func (*ValidatorIntP[T]) LessThan ¶
func (validator *ValidatorIntP[T]) LessThan(value T, template ...string) *ValidatorIntP[T]
Validate if the int pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := int(2) Is(v.IntP(&quantity).LessThan(int(3)))
func (*ValidatorIntP[T]) Nil ¶
func (validator *ValidatorIntP[T]) Nil(template ...string) *ValidatorIntP[T]
Validate if the int pointer value is nil.
For example:
var quantity *int Is(v.IntP(quantity).Nil()) // Will be true
func (*ValidatorIntP[T]) Not ¶
func (validator *ValidatorIntP[T]) Not() *ValidatorIntP[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := int(0) Is(v.IntP(&n).Not().Zero()).Valid()
func (*ValidatorIntP[T]) Passing ¶
func (validator *ValidatorIntP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorIntP[T]
Validate if the int pointer value passes a custom function. For example:
quantity := int(2) Is(v.IntP(&quantity).Passing((v *int) bool { return *v == getAllowedQuantity() })
func (*ValidatorIntP[T]) Zero ¶
func (validator *ValidatorIntP[T]) Zero(template ...string) *ValidatorIntP[T]
Validate if the int pointer value is zero.
For example:
n := int(0) Is(v.IntP(&n).Zero())
func (*ValidatorIntP[T]) ZeroOrNil ¶
func (validator *ValidatorIntP[T]) ZeroOrNil(template ...string) *ValidatorIntP[T]
Validate if the int pointer value is zero or nil.
For example:
var _quantity *int Is(v.IntP(_quantity).ZeroOrNil()) // Will be true
type ValidatorNumber ¶
type ValidatorNumber[T TypeNumber] struct { // contains filtered or unexported fields }
The ValidatorNumber provides functions for setting validation rules for a TypeNumber value type, or a custom type based on a TypeNumber.
TypeNumber is a generic interface defined by Valgo that generalizes any standard Golang type.
func Number ¶
func Number[T TypeNumber](value T, nameAndTitle ...string) *ValidatorNumber[T]
func (*ValidatorNumber[T]) Between ¶
func (validator *ValidatorNumber[T]) Between(min T, max T, template ...string) *ValidatorNumber[T]
Validate if a number is within a range (inclusive). For example:
Is(v.Number(3).Between(2,6))
func (*ValidatorNumber[T]) Context ¶
func (validator *ValidatorNumber[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorNumber[T]) EqualTo ¶
func (validator *ValidatorNumber[T]) EqualTo(value T, template ...string) *ValidatorNumber[T]
Validate if a numeric value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := 2 Is(v.Number(quantity).Equal(2))
func (*ValidatorNumber[T]) GreaterOrEqualTo ¶
func (validator *ValidatorNumber[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorNumber[T]
Validate if a numeric value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := 3 Is(v.Number(quantity).GreaterOrEqualTo(3))
func (*ValidatorNumber[T]) GreaterThan ¶
func (validator *ValidatorNumber[T]) GreaterThan(value T, template ...string) *ValidatorNumber[T]
Validate if a numeric value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := 3 Is(v.Number(quantity).GreaterThan(2))
func (*ValidatorNumber[T]) InSlice ¶
func (validator *ValidatorNumber[T]) InSlice(slice []T, template ...string) *ValidatorNumber[T]
Validate if a number is present in a numeric slice. For example:
quantity := 3 validQuantities := []int{1,3,5} Is(v.Number(quantity).InSlice(validQuantities))
func (*ValidatorNumber[T]) LessOrEqualTo ¶
func (validator *ValidatorNumber[T]) LessOrEqualTo(value T, template ...string) *ValidatorNumber[T]
Validate if a numeric value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := 2 Is(v.Number(quantity).LessOrEqualTo(2))
func (*ValidatorNumber[T]) LessThan ¶
func (validator *ValidatorNumber[T]) LessThan(value T, template ...string) *ValidatorNumber[T]
Validate if a numeric value is less than another. This function internally uses the golang `<` operator. For example:
quantity := 2 Is(v.Number(quantity).LessThan(3))
func (*ValidatorNumber[T]) Not ¶
func (validator *ValidatorNumber[T]) Not() *ValidatorNumber[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Number(0).Not().Zero()).Valid()
func (*ValidatorNumber[T]) Passing ¶
func (validator *ValidatorNumber[T]) Passing(function func(v T) bool, template ...string) *ValidatorNumber[T]
Validate if a numeric value passes a custom function. For example:
quantity := 2 Is(v.Number(quantity).Passing((v int) bool { return v == getAllowedQuantity() })
func (*ValidatorNumber[T]) Zero ¶
func (validator *ValidatorNumber[T]) Zero(template ...string) *ValidatorNumber[T]
Validate if a numeric value is zero.
For example:
Is(v.Number(0).Zero())
type ValidatorNumberP ¶
type ValidatorNumberP[T TypeNumber] struct { // contains filtered or unexported fields }
The Numeric pointer validator type that keeps its validator context.
func NumberP ¶
func NumberP[T TypeNumber](value *T, nameAndTitle ...string) *ValidatorNumberP[T]
Receives a numeric pointer to validate.
The value can be any golang numeric pointer type (*int64, *int32, *float32, *uint, etc.) or a custom numeric type such as `type Level *int32;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorNumberP[T]) Between ¶
func (validator *ValidatorNumberP[T]) Between(min T, max T, template ...string) *ValidatorNumberP[T]
Validate if the value of a numeric pointer is within a range (inclusive). For example:
n := 3 Is(v.NumberP(&n).Between(2,6))
func (*ValidatorNumberP[T]) Context ¶
func (validator *ValidatorNumberP[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorNumberP[T]) EqualTo ¶
func (validator *ValidatorNumberP[T]) EqualTo(value T, template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := 2 Is(v.NumberP(quantity).Equal(2))
func (*ValidatorNumberP[T]) GreaterOrEqualTo ¶
func (validator *ValidatorNumberP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := 3 Is(v.NumberP(&quantity).GreaterOrEqualTo(3))
func (*ValidatorNumberP[T]) GreaterThan ¶
func (validator *ValidatorNumberP[T]) GreaterThan(value T, template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := 3 Is(v.NumberP(&quantity).GreaterThan(2))
func (*ValidatorNumberP[T]) InSlice ¶
func (validator *ValidatorNumberP[T]) InSlice(slice []T, template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value is present in a numeric slice. For example:
quantity := 3 validQuantities := []int{1,3,5} Is(v.NumberP(&quantity).InSlice(validQuantities))
func (*ValidatorNumberP[T]) LessOrEqualTo ¶
func (validator *ValidatorNumberP[T]) LessOrEqualTo(value T, template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := 2 Is(v.NumberP(&quantity).LessOrEqualTo(2))
func (*ValidatorNumberP[T]) LessThan ¶
func (validator *ValidatorNumberP[T]) LessThan(value T, template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := 2 Is(v.NumberP(&quantity).LessThan(3))
func (*ValidatorNumberP[T]) Nil ¶
func (validator *ValidatorNumberP[T]) Nil(template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value is nil.
For example:
var quantity *int Is(v.NumberP(quantity).Nil()) // Will be true
func (*ValidatorNumberP[T]) Not ¶
func (validator *ValidatorNumberP[T]) Not() *ValidatorNumberP[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := 0 Is(v.NumberP(&n).Not().Zero()).Valid()
func (*ValidatorNumberP[T]) Passing ¶
func (validator *ValidatorNumberP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value passes a custom function. For example:
quantity := 2 Is(v.NumberP(&quantity).Passing((v *int) bool { return *v == getAllowedQuantity() })
func (*ValidatorNumberP[T]) Zero ¶
func (validator *ValidatorNumberP[T]) Zero(template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value is zero.
For example:
n := 0 Is(v.NumberP(&n).Zero())
func (*ValidatorNumberP[T]) ZeroOrNil ¶
func (validator *ValidatorNumberP[T]) ZeroOrNil(template ...string) *ValidatorNumberP[T]
Validate if a numeric pointer value is zero or nil.
For example:
var _quantity *int Is(v.NumberP(_quantity).ZeroOrNil()) // Will be true
type ValidatorRune ¶
type ValidatorRune[T ~rune] struct { // contains filtered or unexported fields }
The rune validator type that keeps its validator context.
func Rune ¶
func Rune[T ~rune](value T, nameAndTitle ...string) *ValidatorRune[T]
func (*ValidatorRune[T]) Between ¶
func (validator *ValidatorRune[T]) Between(min T, max T, template ...string) *ValidatorRune[T]
Validate if the rune is within a range (inclusive). For example:
Is(v.Rune(rune(3)).Between(rune(2),rune(6)))
func (*ValidatorRune[T]) Context ¶
func (validator *ValidatorRune[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorRune[T]) EqualTo ¶
func (validator *ValidatorRune[T]) EqualTo(value T, template ...string) *ValidatorRune[T]
Validate if the rune value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := rune(2) Is(v.Rune(quantity).Equal(rune(2)))
func (*ValidatorRune[T]) GreaterOrEqualTo ¶
func (validator *ValidatorRune[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorRune[T]
Validate if the rune value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := rune(3) Is(v.Rune(quantity).GreaterOrEqualTo(rune(3)))
func (*ValidatorRune[T]) GreaterThan ¶
func (validator *ValidatorRune[T]) GreaterThan(value T, template ...string) *ValidatorRune[T]
Validate if the rune value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := rune(3) Is(v.Rune(quantity).GreaterThan(rune(2)))
func (*ValidatorRune[T]) InSlice ¶
func (validator *ValidatorRune[T]) InSlice(slice []T, template ...string) *ValidatorRune[T]
Validate if the rune value is present in the rune slice. For example:
quantity := rune(3) validQuantities := []rune{1,3,5} Is(v.Rune(quantity).InSlice(validQuantities))
func (*ValidatorRune[T]) LessOrEqualTo ¶
func (validator *ValidatorRune[T]) LessOrEqualTo(value T, template ...string) *ValidatorRune[T]
Validate if the rune value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := rune(2) Is(v.Rune(quantity).LessOrEqualTo(rune(2)))
func (*ValidatorRune[T]) LessThan ¶
func (validator *ValidatorRune[T]) LessThan(value T, template ...string) *ValidatorRune[T]
Validate if the rune value is less than another. This function internally uses the golang `<` operator. For example:
quantity := rune(2) Is(v.Rune(quantity).LessThan(rune(3)))
func (*ValidatorRune[T]) Not ¶
func (validator *ValidatorRune[T]) Not() *ValidatorRune[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Rune(rune(0)).Not().Zero()).Valid()
func (*ValidatorRune[T]) Passing ¶
func (validator *ValidatorRune[T]) Passing(function func(v T) bool, template ...string) *ValidatorRune[T]
Validate if the rune value passes a custom function. For example:
quantity := rune(2) Is(v.Rune(quantity).Passing((v rune) bool { return v == getAllowedQuantity() })
func (*ValidatorRune[T]) Zero ¶
func (validator *ValidatorRune[T]) Zero(template ...string) *ValidatorRune[T]
Validate if the rune value is zero.
For example:
Is(v.Rune(rune(0)).Zero())
type ValidatorRuneP ¶
type ValidatorRuneP[T ~rune] struct { // contains filtered or unexported fields }
The rune pointer validator type that keeps its validator context.
func RuneP ¶
func RuneP[T ~rune](value *T, nameAndTitle ...string) *ValidatorRuneP[T]
Receives the rune pointer to validate.
The value also can be a custom rune type such as `type Level *rune;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorRuneP[T]) Between ¶
func (validator *ValidatorRuneP[T]) Between(min T, max T, template ...string) *ValidatorRuneP[T]
Validate if the value of the rune pointer is within a range (inclusive). For example:
n := rune(3) Is(v.RuneP(&n).Between(rune(2),rune(6)))
func (*ValidatorRuneP[T]) Context ¶
func (validator *ValidatorRuneP[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorRuneP[T]) EqualTo ¶
func (validator *ValidatorRuneP[T]) EqualTo(value T, template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := rune(2) Is(v.RuneP(quantity).Equal(rune(2)))
func (*ValidatorRuneP[T]) GreaterOrEqualTo ¶
func (validator *ValidatorRuneP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := rune(3) Is(v.RuneP(&quantity).GreaterOrEqualTo(rune(3)))
func (*ValidatorRuneP[T]) GreaterThan ¶
func (validator *ValidatorRuneP[T]) GreaterThan(value T, template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := rune(3) Is(v.RuneP(&quantity).GreaterThan(rune(2)))
func (*ValidatorRuneP[T]) InSlice ¶
func (validator *ValidatorRuneP[T]) InSlice(slice []T, template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value is present in a numeric slice. For example:
quantity := rune(3) validQuantities := []rune{1,3,5} Is(v.RuneP(&quantity).InSlice(validQuantities))
func (*ValidatorRuneP[T]) LessOrEqualTo ¶
func (validator *ValidatorRuneP[T]) LessOrEqualTo(value T, template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := rune(2) Is(v.RuneP(&quantity).LessOrEqualTo(rune(2)))
func (*ValidatorRuneP[T]) LessThan ¶
func (validator *ValidatorRuneP[T]) LessThan(value T, template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := rune(2) Is(v.RuneP(&quantity).LessThan(rune(3)))
func (*ValidatorRuneP[T]) Nil ¶
func (validator *ValidatorRuneP[T]) Nil(template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value is nil.
For example:
var quantity *rune Is(v.RuneP(quantity).Nil()) // Will be true
func (*ValidatorRuneP[T]) Not ¶
func (validator *ValidatorRuneP[T]) Not() *ValidatorRuneP[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := rune(0) Is(v.RuneP(&n).Not().Zero()).Valid()
func (*ValidatorRuneP[T]) Passing ¶
func (validator *ValidatorRuneP[T]) Passing(function func(v *T) bool, template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value passes a custom function. For example:
quantity := rune(2) Is(v.RuneP(&quantity).Passing((v *rune) bool { return *v == getAllowedQuantity() })
func (*ValidatorRuneP[T]) Zero ¶
func (validator *ValidatorRuneP[T]) Zero(template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value is zero.
For example:
n := rune(0) Is(v.RuneP(&n).Zero())
func (*ValidatorRuneP[T]) ZeroOrNil ¶
func (validator *ValidatorRuneP[T]) ZeroOrNil(template ...string) *ValidatorRuneP[T]
Validate if the rune pointer value is zero or nil.
For example:
var _quantity *rune Is(v.RuneP(_quantity).ZeroOrNil()) // Will be true
type ValidatorString ¶
type ValidatorString[T ~string] struct { // contains filtered or unexported fields }
The `ValidatorString` provides functions for setting validation rules for a string value type, or a custom type based on a string.
func String ¶
func String[T ~string](value T, nameAndTitle ...string) *ValidatorString[T]
func (*ValidatorString[T]) Between ¶
func (validator *ValidatorString[T]) Between(min T, max T, template ...string) *ValidatorString[T]
Validate if the value of a string is within a range (inclusive). For example:
slug := "ab" Is(v.String(slug).Between("ab","ac"))
func (*ValidatorString[T]) Blank ¶
func (validator *ValidatorString[T]) Blank(template ...string) *ValidatorString[T]
Validate if a string value is blank. Blank will be true if the length of the string is zero or if the string only has spaces. For example:
Is(v.String("").Empty()) // Will be true Is(v.String(" ").Empty()) // Will be true
func (*ValidatorString[T]) Context ¶
func (validator *ValidatorString[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorString[T]) Empty ¶
func (validator *ValidatorString[T]) Empty(template ...string) *ValidatorString[T]
Validate if a string value is empty. Return false if the length of the string is greater than zero, even if the string has only spaces.
For checking if the string has only spaces, use the function `Blank()` instead. For example:
Is(v.String("").Empty()) // Will be true Is(v.String(" ").Empty()) // Will be false
func (*ValidatorString[T]) EqualTo ¶
func (validator *ValidatorString[T]) EqualTo(value T, template ...string) *ValidatorString[T]
Validate if a string value is equal to another. This function internally uses the golang `==` operator. For example:
status := "running" Is(v.String(status).Equal("running"))
func (*ValidatorString[T]) GreaterOrEqualTo ¶
func (validator *ValidatorString[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorString[T]
Validate if a string value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
section := "bc" Is(v.String(section).GreaterOrEqualTo("bc"))
func (*ValidatorString[T]) GreaterThan ¶
func (validator *ValidatorString[T]) GreaterThan(value T, template ...string) *ValidatorString[T]
Validate if a string value is greater than another. This function internally uses the golang `>` operator. For example:
section := "bb" Is(v.String(section).GreaterThan("ba"))
func (*ValidatorString[T]) InSlice ¶
func (validator *ValidatorString[T]) InSlice(slice []T, template ...string) *ValidatorString[T]
Validate if a string is present in a string slice. For example:
status := "idle" validStatus := []string{"idle", "paused", "stopped"} Is(v.String(status).InSlice(validStatus))
func (*ValidatorString[T]) LessOrEqualTo ¶
func (validator *ValidatorString[T]) LessOrEqualTo(value T, template ...string) *ValidatorString[T]
Validate if a string value is less than or equal to another. This function internally uses the golang `<=` operator to compare two strings. For example:
section := "bc" Is(v.String(section).LessOrEqualTo("bc"))
func (*ValidatorString[T]) LessThan ¶
func (validator *ValidatorString[T]) LessThan(value T, template ...string) *ValidatorString[T]
Validate if a string value is less than another. This function internally uses the golang `<` operator. For example:
section := "bb" Is(v.String(section).LessThan("bc"))
func (*ValidatorString[T]) MatchingTo ¶
func (validator *ValidatorString[T]) MatchingTo(regex *regexp.Regexp, template ...string) *ValidatorString[T]
Validate if a string matches a regular expression. For example:
status := "pre-approved" regex, _ := regexp.Compile("pre-.+") Is(v.String(status).MatchingTo(regex))
func (*ValidatorString[T]) MaxLength ¶
func (validator *ValidatorString[T]) MaxLength(length int, template ...string) *ValidatorString[T]
Validate the maximum length of a string. For example:
slug := "myname" Is(v.String(slug).MaxLength(6))
func (*ValidatorString[T]) MinLength ¶
func (validator *ValidatorString[T]) MinLength(length int, template ...string) *ValidatorString[T]
Validate the minimum length of a string. For example:
slug := "myname" Is(v.String(slug).MinLength(6))
func (*ValidatorString[T]) Not ¶
func (validator *ValidatorString[T]) Not() *ValidatorString[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Blank() function Is(v.String("").Not().Blank()).Valid()
func (*ValidatorString[T]) OfLength ¶
func (validator *ValidatorString[T]) OfLength(length int, template ...string) *ValidatorString[T]
Validate the length of a string. For example:
slug := "myname" Is(v.String(slug).OfLength(6))
func (*ValidatorString[T]) OfLengthBetween ¶
func (validator *ValidatorString[T]) OfLengthBetween(min int, max int, template ...string) *ValidatorString[T]
Validate if the length of a string is within a range (inclusive). For example:
slug := "myname" Is(v.String(slug).OfLengthBetween(2,6))
func (*ValidatorString[T]) Passing ¶
func (validator *ValidatorString[T]) Passing(function func(v0 T) bool, template ...string) *ValidatorString[T]
Validate if a string value passes a custom function. For example:
status := "" Is(v.String(status).Passing((v string) bool { return v == getNewStatus() })
type ValidatorStringP ¶
type ValidatorStringP[T ~string] struct { // contains filtered or unexported fields }
The String pointer validator type that keeps its validator context.
func StringP ¶
func StringP[T ~string](value *T, nameAndTitle ...string) *ValidatorStringP[T]
func (*ValidatorStringP[T]) Between ¶
func (validator *ValidatorStringP[T]) Between(min T, max T, template ...string) *ValidatorStringP[T]
Validate if the value of a string is in a range (inclusive). For example:
slug := "myname" Is(v.StringP(&slug).Between(2,6))
func (*ValidatorStringP[T]) Blank ¶
func (validator *ValidatorStringP[T]) Blank(template ...string) *ValidatorStringP[T]
Validate if a string value is blank. Blank will be true if the length of the string is zero or if the string only has spaces. For example:
status := "" Is(v.StringP(&status).Blank()) // Will be true status = " " Is(v.StringP(&status).Blank()) // Will be true
func (*ValidatorStringP[T]) BlankOrNil ¶
func (validator *ValidatorStringP[T]) BlankOrNil(template ...string) *ValidatorStringP[T]
Validate if a string value is blank or nil. Blank will be true if the length of the string is zero or if the string only has spaces. For example:
status := "" Is(v.StringP(&status).BlankOrNil()) // Will be true status = " " Is(v.StringP(&status).BlankOrNil()) // Will be true var _status *string Is(v.StringP(_status).BlankOrNil()) // Will be true
func (*ValidatorStringP[T]) Context ¶
func (validator *ValidatorStringP[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorStringP[T]) Empty ¶
func (validator *ValidatorStringP[T]) Empty(template ...string) *ValidatorStringP[T]
Validate if a string value is empty. Empty will be false if the length of the string is greater than zero, even if the string has only spaces. For checking if the string has only spaces, uses the function `Blank()` instead. For example:
status := "" Is(v.StringP(&status).Empty()) // Will be true status = " " Is(v.StringP(&status).Empty()) // Will be false
func (*ValidatorStringP[T]) EmptyOrNil ¶
func (validator *ValidatorStringP[T]) EmptyOrNil(template ...string) *ValidatorStringP[T]
Validate if a string value is empty or nil. Empty will be false if the length of the string is greater than zero, even if the string has only spaces. For checking if the string has only spaces, uses the function `BlankOrNil()` instead. For example:
status := "" Is(v.StringP(&status).EmptyOrNil()) // Will be true status = " " Is(v.StringP(&status).EmptyOrNil()) // Will be false var _status *string Is(v.StringP(_status).EmptyOrNil()) // Will be true
func (*ValidatorStringP[T]) EqualTo ¶
func (validator *ValidatorStringP[T]) EqualTo(value T, template ...string) *ValidatorStringP[T]
Validate if the value of a string pointer is equal to a another value. For example:
status := "running" Is(v.StringP(&status).Equal("running"))
func (*ValidatorStringP[T]) GreaterOrEqualTo ¶
func (validator *ValidatorStringP[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorStringP[T]
func (*ValidatorStringP[T]) GreaterThan ¶
func (validator *ValidatorStringP[T]) GreaterThan(value T, template ...string) *ValidatorStringP[T]
Validate if a string value is greater than another. This function internally uses the golang `>` operator. For example:
section := "bb" Is(v.StringP(§ion).GreaterThan("ba"))
func (*ValidatorStringP[T]) InSlice ¶
func (validator *ValidatorStringP[T]) InSlice(slice []T, template ...string) *ValidatorStringP[T]
Validate if the value of a string pointer is present in a string slice. For example:
status := "idle" validStatus := []string{"idle", "paused", "stopped"} Is(v.StringP(&status).InSlice(validStatus))
func (*ValidatorStringP[T]) LessOrEqualTo ¶
func (validator *ValidatorStringP[T]) LessOrEqualTo(value T, template ...string) *ValidatorStringP[T]
Validate if a string value is less or equal to another. This function internally uses the golang `<=` operator to compare two strings. For example:
section := "bc" Is(v.StringP(§ion).LessOrEqualTo("bc"))
func (*ValidatorStringP[T]) LessThan ¶
func (validator *ValidatorStringP[T]) LessThan(value T, template ...string) *ValidatorStringP[T]
Validate if a string value is less than another. This function internally uses the golang `<` operator. For example:
section := "bb" Is(v.StringP(§ion).LessThan("bc"))
func (*ValidatorStringP[T]) MatchingTo ¶
func (validator *ValidatorStringP[T]) MatchingTo(regex *regexp.Regexp, template ...string) *ValidatorStringP[T]
Validate if the value of a string pointer match a regular expression. For example:
status := "pre-approved" regex, _ := regexp.Compile("pre-.+") Is(v.StringP(&status).MatchingTo(regex))
func (*ValidatorStringP[T]) MaxLength ¶
func (validator *ValidatorStringP[T]) MaxLength(length int, template ...string) *ValidatorStringP[T]
Validate if the maximum length of a string pointer's value. For example:
slug := "myname" Is(v.StringP(&slug).MaxLength(6))
func (*ValidatorStringP[T]) MinLength ¶
func (validator *ValidatorStringP[T]) MinLength(length int, template ...string) *ValidatorStringP[T]
Validate the minimum length of a string pointer's value For example:
slug := "myname" Is(v.StringP(&slug).MinLength(6))
func (*ValidatorStringP[T]) Nil ¶
func (validator *ValidatorStringP[T]) Nil(template ...string) *ValidatorStringP[T]
Validate if a string pointer is nil. For example:
var status *string Is(v.StringP(status).Nil())
func (*ValidatorStringP[T]) Not ¶
func (validator *ValidatorStringP[T]) Not() *ValidatorStringP[T]
Invert the logical value associated to the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Blank() function status := "" Is(v.StringP(&status).Not().Blank()).Valid()
func (*ValidatorStringP[T]) OfLength ¶
func (validator *ValidatorStringP[T]) OfLength(length int, template ...string) *ValidatorStringP[T]
Validate the length of a string pointer's value. For example:
slug := "myname" Is(v.StringP(&slug).OfLength(6))
func (*ValidatorStringP[T]) OfLengthBetween ¶
func (validator *ValidatorStringP[T]) OfLengthBetween(min int, max int, template ...string) *ValidatorStringP[T]
Validate if the length of a string pointer's value is in a range (inclusive). For example:
slug := "myname" Is(v.StringP(&slug).OfLengthBetween(2,6))
func (*ValidatorStringP[T]) Passing ¶
func (validator *ValidatorStringP[T]) Passing(function func(v0 *T) bool, template ...string) *ValidatorStringP[T]
Validate if a string pointer pass a custom function. For example:
status := "" Is(v.StringP(&status).Passing((v string) bool { return v == getNewStatus() })
type ValidatorUint16 ¶
type ValidatorUint16[T ~uint16] struct { // contains filtered or unexported fields }
The uint16 validator type that keeps its validator context.
func Uint16 ¶
func Uint16[T ~uint16](value T, nameAndTitle ...string) *ValidatorUint16[T]
func (*ValidatorUint16[T]) Between ¶
func (validator *ValidatorUint16[T]) Between(min T, max T, template ...string) *ValidatorUint16[T]
Validate if the uint16 is within a range (inclusive). For example:
Is(v.Uint16(uint16(3)).Between(uint16(2),uint16(6)))
func (*ValidatorUint16[T]) Context ¶
func (validator *ValidatorUint16[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorUint16[T]) EqualTo ¶
func (validator *ValidatorUint16[T]) EqualTo(value T, template ...string) *ValidatorUint16[T]
Validate if the uint16 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := uint16(2) Is(v.Uint16(quantity).Equal(uint16(2)))
func (*ValidatorUint16[T]) GreaterOrEqualTo ¶
func (validator *ValidatorUint16[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint16[T]
Validate if the uint16 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := uint16(3) Is(v.Uint16(quantity).GreaterOrEqualTo(uint16(3)))
func (*ValidatorUint16[T]) GreaterThan ¶
func (validator *ValidatorUint16[T]) GreaterThan(value T, template ...string) *ValidatorUint16[T]
Validate if the uint16 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := uint16(3) Is(v.Uint16(quantity).GreaterThan(uint16(2)))
func (*ValidatorUint16[T]) InSlice ¶
func (validator *ValidatorUint16[T]) InSlice(slice []T, template ...string) *ValidatorUint16[T]
Validate if the uint16 value is present in the uint16 slice. For example:
quantity := uint16(3) validQuantities := []uint16{1,3,5} Is(v.Uint16(quantity).InSlice(validQuantities))
func (*ValidatorUint16[T]) LessOrEqualTo ¶
func (validator *ValidatorUint16[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint16[T]
Validate if the uint16 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := uint16(2) Is(v.Uint16(quantity).LessOrEqualTo(uint16(2)))
func (*ValidatorUint16[T]) LessThan ¶
func (validator *ValidatorUint16[T]) LessThan(value T, template ...string) *ValidatorUint16[T]
Validate if the uint16 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := uint16(2) Is(v.Uint16(quantity).LessThan(uint16(3)))
func (*ValidatorUint16[T]) Not ¶
func (validator *ValidatorUint16[T]) Not() *ValidatorUint16[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Uint16(uint16(0)).Not().Zero()).Valid()
func (*ValidatorUint16[T]) Passing ¶
func (validator *ValidatorUint16[T]) Passing(function func(v T) bool, template ...string) *ValidatorUint16[T]
Validate if the uint16 value passes a custom function. For example:
quantity := uint16(2) Is(v.Uint16(quantity).Passing((v uint16) bool { return v == getAllowedQuantity() })
func (*ValidatorUint16[T]) Zero ¶
func (validator *ValidatorUint16[T]) Zero(template ...string) *ValidatorUint16[T]
Validate if the uint16 value is zero.
For example:
Is(v.Uint16(uint16(0)).Zero())
type ValidatorUint16P ¶
type ValidatorUint16P[T ~uint16] struct { // contains filtered or unexported fields }
The uint16 pointer validator type that keeps its validator context.
func Uint16P ¶
func Uint16P[T ~uint16](value *T, nameAndTitle ...string) *ValidatorUint16P[T]
Receives the uint16 pointer to validate.
The value also can be a custom uint16 type such as `type Level *uint16;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorUint16P[T]) Between ¶
func (validator *ValidatorUint16P[T]) Between(min T, max T, template ...string) *ValidatorUint16P[T]
Validate if the value of the uint16 pointer is within a range (inclusive). For example:
n := uint16(3) Is(v.Uint16P(&n).Between(uint16(2),uint16(6)))
func (*ValidatorUint16P[T]) Context ¶
func (validator *ValidatorUint16P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorUint16P[T]) EqualTo ¶
func (validator *ValidatorUint16P[T]) EqualTo(value T, template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := uint16(2) Is(v.Uint16P(quantity).Equal(uint16(2)))
func (*ValidatorUint16P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorUint16P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := uint16(3) Is(v.Uint16P(&quantity).GreaterOrEqualTo(uint16(3)))
func (*ValidatorUint16P[T]) GreaterThan ¶
func (validator *ValidatorUint16P[T]) GreaterThan(value T, template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := uint16(3) Is(v.Uint16P(&quantity).GreaterThan(uint16(2)))
func (*ValidatorUint16P[T]) InSlice ¶
func (validator *ValidatorUint16P[T]) InSlice(slice []T, template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value is present in a numeric slice. For example:
quantity := uint16(3) validQuantities := []uint16{1,3,5} Is(v.Uint16P(&quantity).InSlice(validQuantities))
func (*ValidatorUint16P[T]) LessOrEqualTo ¶
func (validator *ValidatorUint16P[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := uint16(2) Is(v.Uint16P(&quantity).LessOrEqualTo(uint16(2)))
func (*ValidatorUint16P[T]) LessThan ¶
func (validator *ValidatorUint16P[T]) LessThan(value T, template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := uint16(2) Is(v.Uint16P(&quantity).LessThan(uint16(3)))
func (*ValidatorUint16P[T]) Nil ¶
func (validator *ValidatorUint16P[T]) Nil(template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value is nil.
For example:
var quantity *uint16 Is(v.Uint16P(quantity).Nil()) // Will be true
func (*ValidatorUint16P[T]) Not ¶
func (validator *ValidatorUint16P[T]) Not() *ValidatorUint16P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := uint16(0) Is(v.Uint16P(&n).Not().Zero()).Valid()
func (*ValidatorUint16P[T]) Passing ¶
func (validator *ValidatorUint16P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value passes a custom function. For example:
quantity := uint16(2) Is(v.Uint16P(&quantity).Passing((v *uint16) bool { return *v == getAllowedQuantity() })
func (*ValidatorUint16P[T]) Zero ¶
func (validator *ValidatorUint16P[T]) Zero(template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value is zero.
For example:
n := uint16(0) Is(v.Uint16P(&n).Zero())
func (*ValidatorUint16P[T]) ZeroOrNil ¶
func (validator *ValidatorUint16P[T]) ZeroOrNil(template ...string) *ValidatorUint16P[T]
Validate if the uint16 pointer value is zero or nil.
For example:
var _quantity *uint16 Is(v.Uint16P(_quantity).ZeroOrNil()) // Will be true
type ValidatorUint32 ¶
type ValidatorUint32[T ~uint32] struct { // contains filtered or unexported fields }
The uint32 validator type that keeps its validator context.
func Uint32 ¶
func Uint32[T ~uint32](value T, nameAndTitle ...string) *ValidatorUint32[T]
func (*ValidatorUint32[T]) Between ¶
func (validator *ValidatorUint32[T]) Between(min T, max T, template ...string) *ValidatorUint32[T]
Validate if the uint32 is within a range (inclusive). For example:
Is(v.Uint32(uint32(3)).Between(uint32(2),uint32(6)))
func (*ValidatorUint32[T]) Context ¶
func (validator *ValidatorUint32[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorUint32[T]) EqualTo ¶
func (validator *ValidatorUint32[T]) EqualTo(value T, template ...string) *ValidatorUint32[T]
Validate if the uint32 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := uint32(2) Is(v.Uint32(quantity).Equal(uint32(2)))
func (*ValidatorUint32[T]) GreaterOrEqualTo ¶
func (validator *ValidatorUint32[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint32[T]
Validate if the uint32 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := uint32(3) Is(v.Uint32(quantity).GreaterOrEqualTo(uint32(3)))
func (*ValidatorUint32[T]) GreaterThan ¶
func (validator *ValidatorUint32[T]) GreaterThan(value T, template ...string) *ValidatorUint32[T]
Validate if the uint32 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := uint32(3) Is(v.Uint32(quantity).GreaterThan(uint32(2)))
func (*ValidatorUint32[T]) InSlice ¶
func (validator *ValidatorUint32[T]) InSlice(slice []T, template ...string) *ValidatorUint32[T]
Validate if the uint32 value is present in the uint32 slice. For example:
quantity := uint32(3) validQuantities := []uint32{1,3,5} Is(v.Uint32(quantity).InSlice(validQuantities))
func (*ValidatorUint32[T]) LessOrEqualTo ¶
func (validator *ValidatorUint32[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint32[T]
Validate if the uint32 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := uint32(2) Is(v.Uint32(quantity).LessOrEqualTo(uint32(2)))
func (*ValidatorUint32[T]) LessThan ¶
func (validator *ValidatorUint32[T]) LessThan(value T, template ...string) *ValidatorUint32[T]
Validate if the uint32 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := uint32(2) Is(v.Uint32(quantity).LessThan(uint32(3)))
func (*ValidatorUint32[T]) Not ¶
func (validator *ValidatorUint32[T]) Not() *ValidatorUint32[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Uint32(uint32(0)).Not().Zero()).Valid()
func (*ValidatorUint32[T]) Passing ¶
func (validator *ValidatorUint32[T]) Passing(function func(v T) bool, template ...string) *ValidatorUint32[T]
Validate if the uint32 value passes a custom function. For example:
quantity := uint32(2) Is(v.Uint32(quantity).Passing((v uint32) bool { return v == getAllowedQuantity() })
func (*ValidatorUint32[T]) Zero ¶
func (validator *ValidatorUint32[T]) Zero(template ...string) *ValidatorUint32[T]
Validate if the uint32 value is zero.
For example:
Is(v.Uint32(uint32(0)).Zero())
type ValidatorUint32P ¶
type ValidatorUint32P[T ~uint32] struct { // contains filtered or unexported fields }
The uint32 pointer validator type that keeps its validator context.
func Uint32P ¶
func Uint32P[T ~uint32](value *T, nameAndTitle ...string) *ValidatorUint32P[T]
Receives the uint32 pointer to validate.
The value also can be a custom uint32 type such as `type Level *uint32;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorUint32P[T]) Between ¶
func (validator *ValidatorUint32P[T]) Between(min T, max T, template ...string) *ValidatorUint32P[T]
Validate if the value of the uint32 pointer is within a range (inclusive). For example:
n := uint32(3) Is(v.Uint32P(&n).Between(uint32(2),uint32(6)))
func (*ValidatorUint32P[T]) Context ¶
func (validator *ValidatorUint32P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorUint32P[T]) EqualTo ¶
func (validator *ValidatorUint32P[T]) EqualTo(value T, template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := uint32(2) Is(v.Uint32P(quantity).Equal(uint32(2)))
func (*ValidatorUint32P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorUint32P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := uint32(3) Is(v.Uint32P(&quantity).GreaterOrEqualTo(uint32(3)))
func (*ValidatorUint32P[T]) GreaterThan ¶
func (validator *ValidatorUint32P[T]) GreaterThan(value T, template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := uint32(3) Is(v.Uint32P(&quantity).GreaterThan(uint32(2)))
func (*ValidatorUint32P[T]) InSlice ¶
func (validator *ValidatorUint32P[T]) InSlice(slice []T, template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value is present in a numeric slice. For example:
quantity := uint32(3) validQuantities := []uint32{1,3,5} Is(v.Uint32P(&quantity).InSlice(validQuantities))
func (*ValidatorUint32P[T]) LessOrEqualTo ¶
func (validator *ValidatorUint32P[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := uint32(2) Is(v.Uint32P(&quantity).LessOrEqualTo(uint32(2)))
func (*ValidatorUint32P[T]) LessThan ¶
func (validator *ValidatorUint32P[T]) LessThan(value T, template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := uint32(2) Is(v.Uint32P(&quantity).LessThan(uint32(3)))
func (*ValidatorUint32P[T]) Nil ¶
func (validator *ValidatorUint32P[T]) Nil(template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value is nil.
For example:
var quantity *uint32 Is(v.Uint32P(quantity).Nil()) // Will be true
func (*ValidatorUint32P[T]) Not ¶
func (validator *ValidatorUint32P[T]) Not() *ValidatorUint32P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := uint32(0) Is(v.Uint32P(&n).Not().Zero()).Valid()
func (*ValidatorUint32P[T]) Passing ¶
func (validator *ValidatorUint32P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value passes a custom function. For example:
quantity := uint32(2) Is(v.Uint32P(&quantity).Passing((v *uint32) bool { return *v == getAllowedQuantity() })
func (*ValidatorUint32P[T]) Zero ¶
func (validator *ValidatorUint32P[T]) Zero(template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value is zero.
For example:
n := uint32(0) Is(v.Uint32P(&n).Zero())
func (*ValidatorUint32P[T]) ZeroOrNil ¶
func (validator *ValidatorUint32P[T]) ZeroOrNil(template ...string) *ValidatorUint32P[T]
Validate if the uint32 pointer value is zero or nil.
For example:
var _quantity *uint32 Is(v.Uint32P(_quantity).ZeroOrNil()) // Will be true
type ValidatorUint64 ¶
type ValidatorUint64[T ~uint64] struct { // contains filtered or unexported fields }
The uint64 validator type that keeps its validator context.
func Uint64 ¶
func Uint64[T ~uint64](value T, nameAndTitle ...string) *ValidatorUint64[T]
func (*ValidatorUint64[T]) Between ¶
func (validator *ValidatorUint64[T]) Between(min T, max T, template ...string) *ValidatorUint64[T]
Validate if the uint64 is within a range (inclusive). For example:
Is(v.Uint64(uint64(3)).Between(uint64(2),uint64(6)))
func (*ValidatorUint64[T]) Context ¶
func (validator *ValidatorUint64[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorUint64[T]) EqualTo ¶
func (validator *ValidatorUint64[T]) EqualTo(value T, template ...string) *ValidatorUint64[T]
Validate if the uint64 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := uint64(2) Is(v.Uint64(quantity).Equal(uint64(2)))
func (*ValidatorUint64[T]) GreaterOrEqualTo ¶
func (validator *ValidatorUint64[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint64[T]
Validate if the uint64 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := uint64(3) Is(v.Uint64(quantity).GreaterOrEqualTo(uint64(3)))
func (*ValidatorUint64[T]) GreaterThan ¶
func (validator *ValidatorUint64[T]) GreaterThan(value T, template ...string) *ValidatorUint64[T]
Validate if the uint64 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := uint64(3) Is(v.Uint64(quantity).GreaterThan(uint64(2)))
func (*ValidatorUint64[T]) InSlice ¶
func (validator *ValidatorUint64[T]) InSlice(slice []T, template ...string) *ValidatorUint64[T]
Validate if the uint64 value is present in the uint64 slice. For example:
quantity := uint64(3) validQuantities := []uint64{1,3,5} Is(v.Uint64(quantity).InSlice(validQuantities))
func (*ValidatorUint64[T]) LessOrEqualTo ¶
func (validator *ValidatorUint64[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint64[T]
Validate if the uint64 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := uint64(2) Is(v.Uint64(quantity).LessOrEqualTo(uint64(2)))
func (*ValidatorUint64[T]) LessThan ¶
func (validator *ValidatorUint64[T]) LessThan(value T, template ...string) *ValidatorUint64[T]
Validate if the uint64 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := uint64(2) Is(v.Uint64(quantity).LessThan(uint64(3)))
func (*ValidatorUint64[T]) Not ¶
func (validator *ValidatorUint64[T]) Not() *ValidatorUint64[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Uint64(uint64(0)).Not().Zero()).Valid()
func (*ValidatorUint64[T]) Passing ¶
func (validator *ValidatorUint64[T]) Passing(function func(v T) bool, template ...string) *ValidatorUint64[T]
Validate if the uint64 value passes a custom function. For example:
quantity := uint64(2) Is(v.Uint64(quantity).Passing((v uint64) bool { return v == getAllowedQuantity() })
func (*ValidatorUint64[T]) Zero ¶
func (validator *ValidatorUint64[T]) Zero(template ...string) *ValidatorUint64[T]
Validate if the uint64 value is zero.
For example:
Is(v.Uint64(uint64(0)).Zero())
type ValidatorUint64P ¶
type ValidatorUint64P[T ~uint64] struct { // contains filtered or unexported fields }
The uint64 pointer validator type that keeps its validator context.
func Uint64P ¶
func Uint64P[T ~uint64](value *T, nameAndTitle ...string) *ValidatorUint64P[T]
Receives the uint64 pointer to validate.
The value also can be a custom uint64 type such as `type Level *uint64;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorUint64P[T]) Between ¶
func (validator *ValidatorUint64P[T]) Between(min T, max T, template ...string) *ValidatorUint64P[T]
Validate if the value of the uint64 pointer is within a range (inclusive). For example:
n := uint64(3) Is(v.Uint64P(&n).Between(uint64(2),uint64(6)))
func (*ValidatorUint64P[T]) Context ¶
func (validator *ValidatorUint64P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorUint64P[T]) EqualTo ¶
func (validator *ValidatorUint64P[T]) EqualTo(value T, template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := uint64(2) Is(v.Uint64P(quantity).Equal(uint64(2)))
func (*ValidatorUint64P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorUint64P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := uint64(3) Is(v.Uint64P(&quantity).GreaterOrEqualTo(uint64(3)))
func (*ValidatorUint64P[T]) GreaterThan ¶
func (validator *ValidatorUint64P[T]) GreaterThan(value T, template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := uint64(3) Is(v.Uint64P(&quantity).GreaterThan(uint64(2)))
func (*ValidatorUint64P[T]) InSlice ¶
func (validator *ValidatorUint64P[T]) InSlice(slice []T, template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value is present in a numeric slice. For example:
quantity := uint64(3) validQuantities := []uint64{1,3,5} Is(v.Uint64P(&quantity).InSlice(validQuantities))
func (*ValidatorUint64P[T]) LessOrEqualTo ¶
func (validator *ValidatorUint64P[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := uint64(2) Is(v.Uint64P(&quantity).LessOrEqualTo(uint64(2)))
func (*ValidatorUint64P[T]) LessThan ¶
func (validator *ValidatorUint64P[T]) LessThan(value T, template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := uint64(2) Is(v.Uint64P(&quantity).LessThan(uint64(3)))
func (*ValidatorUint64P[T]) Nil ¶
func (validator *ValidatorUint64P[T]) Nil(template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value is nil.
For example:
var quantity *uint64 Is(v.Uint64P(quantity).Nil()) // Will be true
func (*ValidatorUint64P[T]) Not ¶
func (validator *ValidatorUint64P[T]) Not() *ValidatorUint64P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := uint64(0) Is(v.Uint64P(&n).Not().Zero()).Valid()
func (*ValidatorUint64P[T]) Passing ¶
func (validator *ValidatorUint64P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value passes a custom function. For example:
quantity := uint64(2) Is(v.Uint64P(&quantity).Passing((v *uint64) bool { return *v == getAllowedQuantity() })
func (*ValidatorUint64P[T]) Zero ¶
func (validator *ValidatorUint64P[T]) Zero(template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value is zero.
For example:
n := uint64(0) Is(v.Uint64P(&n).Zero())
func (*ValidatorUint64P[T]) ZeroOrNil ¶
func (validator *ValidatorUint64P[T]) ZeroOrNil(template ...string) *ValidatorUint64P[T]
Validate if the uint64 pointer value is zero or nil.
For example:
var _quantity *uint64 Is(v.Uint64P(_quantity).ZeroOrNil()) // Will be true
type ValidatorUint8 ¶
type ValidatorUint8[T ~uint8] struct { // contains filtered or unexported fields }
The uint8 validator type that keeps its validator context.
func Uint8 ¶
func Uint8[T ~uint8](value T, nameAndTitle ...string) *ValidatorUint8[T]
func (*ValidatorUint8[T]) Between ¶
func (validator *ValidatorUint8[T]) Between(min T, max T, template ...string) *ValidatorUint8[T]
Validate if the uint8 is within a range (inclusive). For example:
Is(v.Uint8(uint8(3)).Between(uint8(2),uint8(6)))
func (*ValidatorUint8[T]) Context ¶
func (validator *ValidatorUint8[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorUint8[T]) EqualTo ¶
func (validator *ValidatorUint8[T]) EqualTo(value T, template ...string) *ValidatorUint8[T]
Validate if the uint8 value is equal to another. This function internally uses the golang `==` operator. For example:
quantity := uint8(2) Is(v.Uint8(quantity).Equal(uint8(2)))
func (*ValidatorUint8[T]) GreaterOrEqualTo ¶
func (validator *ValidatorUint8[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint8[T]
Validate if the uint8 value is greater than or equal to another. This function internally uses the golang `>=` operator. For example:
quantity := uint8(3) Is(v.Uint8(quantity).GreaterOrEqualTo(uint8(3)))
func (*ValidatorUint8[T]) GreaterThan ¶
func (validator *ValidatorUint8[T]) GreaterThan(value T, template ...string) *ValidatorUint8[T]
Validate if the uint8 value is greater than another. This function internally uses the golang `>` operator. For example:
quantity := uint8(3) Is(v.Uint8(quantity).GreaterThan(uint8(2)))
func (*ValidatorUint8[T]) InSlice ¶
func (validator *ValidatorUint8[T]) InSlice(slice []T, template ...string) *ValidatorUint8[T]
Validate if the uint8 value is present in the uint8 slice. For example:
quantity := uint8(3) validQuantities := []uint8{1,3,5} Is(v.Uint8(quantity).InSlice(validQuantities))
func (*ValidatorUint8[T]) LessOrEqualTo ¶
func (validator *ValidatorUint8[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint8[T]
Validate if the uint8 value is less than or equal to another. This function internally uses the golang `<=` operator. For example:
quantity := uint8(2) Is(v.Uint8(quantity).LessOrEqualTo(uint8(2)))
func (*ValidatorUint8[T]) LessThan ¶
func (validator *ValidatorUint8[T]) LessThan(value T, template ...string) *ValidatorUint8[T]
Validate if the uint8 value is less than another. This function internally uses the golang `<` operator. For example:
quantity := uint8(2) Is(v.Uint8(quantity).LessThan(uint8(3)))
func (*ValidatorUint8[T]) Not ¶
func (validator *ValidatorUint8[T]) Not() *ValidatorUint8[T]
Invert the logical value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function Is(v.Uint8(uint8(0)).Not().Zero()).Valid()
func (*ValidatorUint8[T]) Passing ¶
func (validator *ValidatorUint8[T]) Passing(function func(v T) bool, template ...string) *ValidatorUint8[T]
Validate if the uint8 value passes a custom function. For example:
quantity := uint8(2) Is(v.Uint8(quantity).Passing((v uint8) bool { return v == getAllowedQuantity() })
func (*ValidatorUint8[T]) Zero ¶
func (validator *ValidatorUint8[T]) Zero(template ...string) *ValidatorUint8[T]
Validate if the uint8 value is zero.
For example:
Is(v.Uint8(uint8(0)).Zero())
type ValidatorUint8P ¶
type ValidatorUint8P[T ~uint8] struct { // contains filtered or unexported fields }
The uint8 pointer validator type that keeps its validator context.
func Uint8P ¶
func Uint8P[T ~uint8](value *T, nameAndTitle ...string) *ValidatorUint8P[T]
Receives the uint8 pointer to validate.
The value also can be a custom uint8 type such as `type Level *uint8;`
Optionally, the function can receive a name and title, in that order, to be used in the error messages. A `value_%N“ pattern is used as a name in error messages if a name and title are not supplied; for example: value_0. When the name is provided but not the title, then the name is humanized to be used as the title as well; for example the name `phone_number` will be humanized as `Phone Number`
func (*ValidatorUint8P[T]) Between ¶
func (validator *ValidatorUint8P[T]) Between(min T, max T, template ...string) *ValidatorUint8P[T]
Validate if the value of the uint8 pointer is within a range (inclusive). For example:
n := uint8(3) Is(v.Uint8P(&n).Between(uint8(2),uint8(6)))
func (*ValidatorUint8P[T]) Context ¶
func (validator *ValidatorUint8P[T]) Context() *ValidatorContext
Return the context of the validator. The context is useful to create a custom validator by extending this validator.
func (*ValidatorUint8P[T]) EqualTo ¶
func (validator *ValidatorUint8P[T]) EqualTo(value T, template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value is equal to another value. This function internally uses the golang `==` operator. For example:
quantity := uint8(2) Is(v.Uint8P(quantity).Equal(uint8(2)))
func (*ValidatorUint8P[T]) GreaterOrEqualTo ¶
func (validator *ValidatorUint8P[T]) GreaterOrEqualTo(value T, template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value is greater than or equal to another value. This function internally uses the golang `>=` operator. For example:
quantity := uint8(3) Is(v.Uint8P(&quantity).GreaterOrEqualTo(uint8(3)))
func (*ValidatorUint8P[T]) GreaterThan ¶
func (validator *ValidatorUint8P[T]) GreaterThan(value T, template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value is greater than another value. This function internally uses the golang `>` operator. For example:
quantity := uint8(3) Is(v.Uint8P(&quantity).GreaterThan(uint8(2)))
func (*ValidatorUint8P[T]) InSlice ¶
func (validator *ValidatorUint8P[T]) InSlice(slice []T, template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value is present in a numeric slice. For example:
quantity := uint8(3) validQuantities := []uint8{1,3,5} Is(v.Uint8P(&quantity).InSlice(validQuantities))
func (*ValidatorUint8P[T]) LessOrEqualTo ¶
func (validator *ValidatorUint8P[T]) LessOrEqualTo(value T, template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value is less than or equal to another value. This function internally uses the golang `<=` operator. For example:
quantity := uint8(2) Is(v.Uint8P(&quantity).LessOrEqualTo(uint8(2)))
func (*ValidatorUint8P[T]) LessThan ¶
func (validator *ValidatorUint8P[T]) LessThan(value T, template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value is less than another value. This function internally uses the golang `<` operator. For example:
quantity := uint8(2) Is(v.Uint8P(&quantity).LessThan(uint8(3)))
func (*ValidatorUint8P[T]) Nil ¶
func (validator *ValidatorUint8P[T]) Nil(template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value is nil.
For example:
var quantity *uint8 Is(v.Uint8P(quantity).Nil()) // Will be true
func (*ValidatorUint8P[T]) Not ¶
func (validator *ValidatorUint8P[T]) Not() *ValidatorUint8P[T]
Invert the boolean value associated with the next validator function. For example:
// It will return false because Not() inverts the boolean value associated with the Zero() function n := uint8(0) Is(v.Uint8P(&n).Not().Zero()).Valid()
func (*ValidatorUint8P[T]) Passing ¶
func (validator *ValidatorUint8P[T]) Passing(function func(v *T) bool, template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value passes a custom function. For example:
quantity := uint8(2) Is(v.Uint8P(&quantity).Passing((v *uint8) bool { return *v == getAllowedQuantity() })
func (*ValidatorUint8P[T]) Zero ¶
func (validator *ValidatorUint8P[T]) Zero(template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value is zero.
For example:
n := uint8(0) Is(v.Uint8P(&n).Zero())
func (*ValidatorUint8P[T]) ZeroOrNil ¶
func (validator *ValidatorUint8P[T]) ZeroOrNil(template ...string) *ValidatorUint8P[T]
Validate if the uint8 pointer value is zero or nil.
For example:
var _quantity *uint8 Is(v.Uint8P(_quantity).ZeroOrNil()) // Will be true
Source Files ¶
- constants.go
- error.go
- factory.go
- locale.go
- locale_de.go
- locale_en.go
- locale_es.go
- util.go
- valgo.go
- validation.go
- validator.go
- validator_any.go
- validator_boolean.go
- validator_boolean_p.go
- validator_context.go
- validator_number.gen.go
- validator_number.go
- validator_number_p.gen.go
- validator_number_p.go
- validator_number_p_test.gen.go
- validator_number_test.gen.go
- validator_string.go
- validator_string_p.go