Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ReValidRef = regexp.MustCompile(`^[^\s]+$`) ReValidBranchID = regexp.MustCompile(`^\w[-\w]*$`) ReValidRepositoryID = regexp.MustCompile(`^[a-z0-9][a-z0-9-]{2,62}$`) )
View Source
var ( ErrInvalid = errors.New("validation error") ErrInvalidType = fmt.Errorf("invalid type: %w", ErrInvalid) ErrRequiredValue = fmt.Errorf("required value: %w", ErrInvalid) ErrInvalidValue = fmt.Errorf("invalid value: %w", ErrInvalid) )
Functions ¶
func Validate ¶
func Validate(args []ValidateArg) error
func ValidateNilOrPositiveInt ¶ added in v0.97.0
func ValidateNilOrPositiveInt(v interface{}) error
func ValidateNonNegativeInt ¶
func ValidateNonNegativeInt(v interface{}) error
func ValidateRequiredString ¶
func ValidateRequiredString(v interface{}) error
Types ¶
type ValidateArg ¶
type ValidateArg struct { Name string Value interface{} Fn ValidateFunc }
type ValidateFunc ¶
type ValidateFunc func(v interface{}) error
func MakeValidateOptional ¶
func MakeValidateOptional(fn ValidateFunc) ValidateFunc
Click to show internal directories.
Click to hide internal directories.