mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-21 16:49:03 +01:00
v0.26.0
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user