minireader/internal/pkg/validator/validator.go

20 lines
265 B
Go
Raw Permalink Normal View History

2023-10-25 14:49:11 +00:00
package validator
import (
"github.com/go-playground/validator/v10"
)
var (
v = validator.New()
)
func Struct(val any) error {
return v.Struct(val)
}
func init() {
_ = v.RegisterValidation("optional", func(f validator.FieldLevel) bool {
return true
})
}