Documentation
¶
Index ¶
- func ValidateType(v any) error
- type AlphaNumStr
- type AlphaStr
- type AwareDateTime
- type Base64Str
- type DirectoryPath
- type EmailStr
- type FilePath
- type FutureDate
- type HexStr
- type HttpUrl
- type LowercaseStr
- type NaiveDateTime
- type NegativeFloat
- type NegativeInt
- type NonNegativeFloat
- type NonNegativeInt
- type NonPositiveFloat
- type NonPositiveInt
- type NumericStr
- type PastDate
- type PositiveFloat
- type PositiveInt
- type UUID
- type UppercaseStr
- type Validatable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateType ¶
ValidateType validates a value if it implements Validatable
Types ¶
type AlphaNumStr ¶
type AlphaNumStr string
AlphaNumStr represents a string containing only letters and numbers
func (AlphaNumStr) Validate ¶
func (a AlphaNumStr) Validate() error
Validate checks if the string contains only alphanumeric characters
type AwareDateTime ¶
AwareDateTime represents a datetime with timezone information
func (AwareDateTime) Time ¶
func (a AwareDateTime) Time() time.Time
Time returns the underlying time.Time
func (AwareDateTime) Validate ¶
func (a AwareDateTime) Validate() error
Validate checks if the datetime has timezone info
type DirectoryPath ¶
type DirectoryPath string
DirectoryPath represents a path to an existing directory
func (DirectoryPath) String ¶
func (d DirectoryPath) String() string
String returns the directory path as a string
func (DirectoryPath) Validate ¶
func (d DirectoryPath) Validate() error
Validate checks if the path points to an existing directory
type FutureDate ¶
FutureDate represents a date that must be in the future
func (FutureDate) Validate ¶
func (f FutureDate) Validate() error
Validate checks if the date is in the future
type LowercaseStr ¶
type LowercaseStr string
LowercaseStr represents a string that must be lowercase
func (LowercaseStr) Validate ¶
func (l LowercaseStr) Validate() error
Validate checks if the string is lowercase
type NaiveDateTime ¶
NaiveDateTime represents a datetime without timezone information
func (NaiveDateTime) Time ¶
func (n NaiveDateTime) Time() time.Time
Time returns the underlying time.Time
func (NaiveDateTime) Validate ¶
func (n NaiveDateTime) Validate() error
Validate checks if the datetime lacks timezone info
type NegativeFloat ¶
type NegativeFloat float64
NegativeFloat represents a float64 < 0
func (NegativeFloat) Validate ¶
func (n NegativeFloat) Validate() error
Validate checks if the value is negative
type NegativeInt ¶
type NegativeInt int
NegativeInt represents an integer < 0
func (NegativeInt) Validate ¶
func (n NegativeInt) Validate() error
Validate checks if the value is negative
type NonNegativeFloat ¶
type NonNegativeFloat float64
NonNegativeFloat represents a float64 >= 0
func (NonNegativeFloat) Validate ¶
func (n NonNegativeFloat) Validate() error
Validate checks if the value is non-negative
type NonNegativeInt ¶
type NonNegativeInt int
NonNegativeInt represents an integer >= 0
func (NonNegativeInt) Validate ¶
func (n NonNegativeInt) Validate() error
Validate checks if the value is non-negative
type NonPositiveFloat ¶
type NonPositiveFloat float64
NonPositiveFloat represents a float64 <= 0
func (NonPositiveFloat) Validate ¶
func (n NonPositiveFloat) Validate() error
Validate checks if the value is non-positive
type NonPositiveInt ¶
type NonPositiveInt int
NonPositiveInt represents an integer <= 0
func (NonPositiveInt) Validate ¶
func (n NonPositiveInt) Validate() error
Validate checks if the value is non-positive
type NumericStr ¶
type NumericStr string
NumericStr represents a string containing only numbers
func (NumericStr) Validate ¶
func (n NumericStr) Validate() error
Validate checks if the string contains only numeric characters
type PositiveFloat ¶
type PositiveFloat float64
PositiveFloat represents a float64 greater than 0
func (PositiveFloat) Validate ¶
func (p PositiveFloat) Validate() error
Validate checks if the value is positive
type PositiveInt ¶
type PositiveInt int
PositiveInt represents an integer greater than 0
func (PositiveInt) Validate ¶
func (p PositiveInt) Validate() error
Validate checks if the value is positive
type UppercaseStr ¶
type UppercaseStr string
UppercaseStr represents a string that must be uppercase
func (UppercaseStr) Validate ¶
func (u UppercaseStr) Validate() error
Validate checks if the string is uppercase
type Validatable ¶
type Validatable interface {
Validate() error
}
Validatable is an interface for types that can validate themselves