Introduce pkg/mail.Addr

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-12-12 15:32:46 +01:00
parent cab9d6f2ed
commit c0b2a5702d
85 changed files with 842 additions and 646 deletions

View File

@@ -17,6 +17,8 @@ package validator
import (
"reflect"
"strings"
"go.probo.inc/probo/pkg/mail"
)
// Required validates that a field has a value.
@@ -59,6 +61,10 @@ func NotEmpty() ValidatorFunc {
if strings.TrimSpace(v) == "" {
return newValidationError(ErrorCodeRequired, "field cannot be empty")
}
case mail.Addr:
if v == mail.Nil {
return newValidationError(ErrorCodeRequired, "field cannot be empty")
}
default:
rv := reflect.ValueOf(actualValue)
if rv.Kind() == reflect.Slice && rv.Len() == 0 {