feat: init project

This commit is contained in:
Steven
2022-09-11 16:38:06 +08:00
commit 5f48be3b7a
48 changed files with 4585 additions and 0 deletions

30
common/util.go Normal file
View File

@ -0,0 +1,30 @@
package common
import (
"net/mail"
"strings"
"github.com/google/uuid"
)
// HasPrefixes returns true if the string s has any of the given prefixes.
func HasPrefixes(src string, prefixes ...string) bool {
for _, prefix := range prefixes {
if strings.HasPrefix(src, prefix) {
return true
}
}
return false
}
// ValidateEmail validates the email.
func ValidateEmail(email string) bool {
if _, err := mail.ParseAddress(email); err != nil {
return false
}
return true
}
func GenUUID() string {
return uuid.New().String()
}