mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-04 22:00:39 +00:00
WIP Generic IsValid for *Id structs
This commit is contained in:
parent
e69e5df089
commit
2e031a9763
3 changed files with 27 additions and 6 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue