feat: user domain -- errors

This commit is contained in:
VQIVS committed 2025-09-02 16:38:12 +03:30
1 parent 5ea90d5c0e
commit 0e32d0d820
11 files changed
+195 -1

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
package phone
import (
"backend/pkg/errors"
"regexp"
)
func IsValid(value string) (bool, error) {
re := regexp.MustCompile(`^(?:0|\+98|0098)(\d{10})$`)
result := re.FindStringSubmatch(value)
if len(result) > 0 {
return true, nil
}
return false, errors.ErrPhoneInvalid
}