
- 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
23 lines
535 B
Go
23 lines
535 B
Go
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
|
|
}
|