-
Notifications
You must be signed in to change notification settings - Fork 1
/
defaults.go
65 lines (47 loc) · 906 Bytes
/
defaults.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package parser
func (c *Config) def() {
c.defPackages()
}
func (c *Config) defPackages() {
c.Packages = map[string]*Package{}
c.addPackage(packageDatabase(c))
c.addPackage(packageORM(c))
c.addPackage(packageQuery(c))
c.addPackage(packageModel(c))
}
func (d *Database) def() {
d.DriverName = defaultDriver
}
func (mo *Model) def() {
mo.SoftDelete = true
mo.CreatedAt = true
mo.UpdatedAt = true
mo.DeletedAt = true
mo.CreatedBy = true
mo.UpdatedBy = true
mo.DeletedBy = true
mo.Uuid = 4
mo.Listed = true
mo.defPrimaryKey()
}
func (t *Table) def() {
t.Schema = ""
t.IsPivot = false
}
func (r *Relation) def() {
}
func (f *Field) def() {
f.Null = true
f.InDB = true
f.Exported = true
f.InEncoding = true
f.defCallbacks()
}
func (f *Field) defCallbacks() {
}
func (mo *Model) defPrimaryKey() {
mo.PrimaryKey = &PrimaryKey{
Model: mo,
Fields: []string{"Id"},
}
}