WIP Generic IsValid for *Id structs

This commit is contained in:
erik 2023-12-22 13:44:45 +01:00 committed by Michael Jerger
parent e69e5df089
commit 2e031a9763
3 changed files with 27 additions and 6 deletions

View file

@ -8,6 +8,7 @@ import (
"strings"
)
/*
type ValidationFunctions interface {
Validate() []string
IsValid() (bool, error)
@ -16,6 +17,11 @@ type ValidationFunctions interface {
type Validateable struct {
ValidationFunctions
}
*/
type Validateable interface {
Validate() []string
}
func IsValid(v any) (bool, error) {
if err := Validate(v); len(err) > 0 {