19 lines
335 B
Go
19 lines
335 B
Go
package validate
|
|
|
|
import "github.com/go-playground/validator/v10"
|
|
|
|
type Validate struct {
|
|
validator *validator.Validate
|
|
}
|
|
|
|
func New() *Validate {
|
|
return &Validate{validator: validator.New()}
|
|
}
|
|
|
|
func (v *Validate) ValidateAll(value any) error {
|
|
if v == nil || v.validator == nil {
|
|
return nil
|
|
}
|
|
return v.validator.Struct(value)
|
|
}
|