-
Notifications
You must be signed in to change notification settings - Fork 1
/
form_control.go
44 lines (38 loc) · 1.16 KB
/
form_control.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package domain
import (
"github.com/go-playground/validator/v10"
)
type FormControlList struct {
Count int32 `json:"count"`
FormControlList []*FormControl `json:"formControlList"`
}
type FormControl struct {
Id int64 `json:"id,omitempty"`
Ref string `json:"ref" validate:"required"`
Name string `json:"name" validate:"required"`
Enabled bool `json:"enabled,omitempty"`
Description string `json:"description,omitempty"`
Control string `json:"control" validate:"required"`
ControlJSON struct {
Key string `json:"key"`
Type string `json:"type"`
TemplateOptions struct {
Label string `json:"label"`
Placeholder string `json:"placeholder"`
Required bool `json:"required"`
} `json:"templateOptions,omitempty"`
} `json:"-,omitempty"`
Version int64 `json:"version,omitempty"`
Audit *Audit `json:"audit,omitempty"`
Links struct {
Type string `json:"type"`
Self string `json:"self"`
} `json:"links,omitempty"`
}
var validate *validator.Validate
func init() {
validate = validator.New()
}
func (o *FormControl) Validate() error {
return validate.Struct(o)
}