-
Notifications
You must be signed in to change notification settings - Fork 0
/
field.go
43 lines (40 loc) · 1.25 KB
/
field.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
package define
import (
"github.com/sohaha/zlsgo/zvalid"
"github.com/zlsgo/zdb/schema"
)
type (
Fields map[string]Field
Field struct {
Default interface{} `json:"default"`
Unique interface{} `json:"unique"`
Index interface{} `json:"index"`
Comment string `json:"comment"`
Label string `json:"label"`
Type schema.DataType `json:"type"`
Validations []Validations `json:"validations"`
Options FieldOption `json:"ModelOptions"`
Before []string `json:"before"`
After []string `json:"after"`
ValidRules zvalid.Engine
Size uint64 `json:"size"`
Nullable bool `json:"nullable"`
// quoteName string `json:"-"`
}
FieldEnum struct {
Value string `json:"value"`
Label string `json:"label"`
}
FieldOption struct {
FormatTime string `json:"format_time"`
Crypt string `json:"crypt"`
Enum []FieldEnum `json:"enum"`
IsArray bool `json:"is_array"`
ReadOnly bool `json:"readonly"`
DisableMigration bool `json:"disable_migration"`
// Quote bool `json:"quote"`
}
)
func (f *Field) GetValidations() *zvalid.Engine {
return &f.ValidRules
}