This commit is contained in:
yusing
2026-02-16 08:59:01 +08:00
parent 15b9635ee1
commit e4e6f6b3e8
242 changed files with 3953 additions and 3502 deletions

View File

@@ -1,22 +1,21 @@
package serialization
import (
"errors"
"reflect"
"testing"
gperr "github.com/yusing/goutils/errs"
)
type CustomValidatingStruct struct {
Value string
}
func (c CustomValidatingStruct) Validate() gperr.Error {
func (c CustomValidatingStruct) Validate() error {
if c.Value == "" {
return gperr.New("value cannot be empty")
return errors.New("value cannot be empty")
}
if len(c.Value) < 3 {
return gperr.New("value must be at least 3 characters")
return errors.New("value must be at least 3 characters")
}
return nil
}