feat: add storage management and utility functions
- Implement storage service for file management - Add support for external and system storage backends - Include utility functions for environment variables - Add hash utilities for secure operations - Implement validation utilities for data integrity - Support file encryption and secure storage - Add proper error handling and logging for storage operations
This commit is contained in:
22
utils/valid.go
Normal file
22
utils/valid.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var emailRegex = regexp.MustCompile(`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`)
|
||||
var domainRegex = regexp.MustCompile(`^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`)
|
||||
|
||||
func IsEmailValid(email string) bool {
|
||||
return emailRegex.MatchString(email)
|
||||
}
|
||||
|
||||
func IsDomainValid(domain string) bool {
|
||||
return domainRegex.MatchString(domain)
|
||||
}
|
||||
|
||||
func IsEmailDomainValid(email, domain string) bool {
|
||||
emailDomain := strings.Split(email, "@")[1]
|
||||
return emailRegex.MatchString(email) && emailDomain == domain
|
||||
}
|
Reference in New Issue
Block a user