Documentation ¶
Index ¶
- Constants
- Variables
- func EnsureValidOrRespond(value string, validator ValidatorFunc, resp http.ResponseWriter) bool
- func IsEmail(str string) bool
- func IsUUID(str string) bool
- func IsValidBranchName(str string) error
- func IsValidPassword(str string) (errs []string)
- func IsValidSnapshotName(str string) error
- func IsValidSubdotName(str string) error
- func IsValidVolume(namespace, name string) error
- func IsValidVolumeName(str string) error
- func IsValidVolumeNamespace(str string) error
- func ReplaceUUID(str, replace string) string
- type ValidatorFunc
Constants ¶
View Source
const ( Email string = "" /* 1212-byte string literal not displayed */ UUID string = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" UUIDPattern string = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" VolumeNamePattern string = `^[a-zA-Z0-9_\-]{1,64}$` VolumeNamespacePattern string = `^[a-zA-Z0-9_\-]{1,64}$` BranchPattern string = `^[a-zA-Z0-9_\-]{1,64}$` SubDotPattern string = `^[a-zA-Z0-9_\-]{1,64}$` SnapshotPattern string = `^[a-zA-Z0-9_\-]{1,64}$` )
url checking consts
Variables ¶
View Source
var ( ErrEmptyName = errors.New("name cannot be empty") ErrEmptyNamespace = errors.New("namespace cannot be empty") ErrEmptySubdot = errors.New("subdot cannot be empty") ErrEmptySnapshot = errors.New("snapshot cannot be empty") ErrInvalidVolumeName = fmt.Errorf("invalid dot name, should match pattern: %s", VolumeNamePattern) ErrInvalidNamespaceName = fmt.Errorf("invalid namespace name, should match pattern: %s", VolumeNamespacePattern) ErrInvalidBranchName = fmt.Errorf("invalid branch name, should match pattern: %s", BranchPattern) ErrInvalidSubdotName = fmt.Errorf("invalid subdot name, should match pattern: %s", SubDotPattern) ErrInvalidSnapshotName = fmt.Errorf("invalid snapshot name, should match pattern: %s", SnapshotPattern) )
errors
Functions ¶
func EnsureValidOrRespond ¶
func EnsureValidOrRespond(value string, validator ValidatorFunc, resp http.ResponseWriter) bool
Return false (and respond with HTTP error) if the value doesn't validate.
func IsValidBranchName ¶
func IsValidPassword ¶
IsValidPassword - checks is user supplied password is valid
func IsValidSnapshotName ¶
func IsValidSubdotName ¶
func IsValidVolume ¶
func IsValidVolumeName ¶
func IsValidVolumeNamespace ¶
Types ¶
type ValidatorFunc ¶
Click to show internal directories.
Click to hide internal directories.