-
Notifications
You must be signed in to change notification settings - Fork 25
/
models.go
43 lines (37 loc) · 966 Bytes
/
models.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 model
import (
"github.com/scryinfo/dot/dots/db"
)
type DataType struct {
Name string
Count int64
}
//go:generate gmodel -typeName=Notice -tableName=notices
//go:generate gdao -typeName=Notice -tableName=notices -daoPackage=dao
type Notice struct {
db.ModelBase
Data DataType `pg:"composite:data"`
Status int
No int `pg:"-"`
}
//go:generate gmodel -typeName=Sub -tableName=subs
//go:generate gdao -typeName=Sub -tableName=subs -daoPackage=dao
type Sub struct {
db.ModelBase
Name string
}
//go:generate gmodel -typeName=HasSub -tableName=has_subs
//go:generate gdao -typeName=HasSub -tableName=has_subs -daoPackage=dao
type HasSub struct {
db.ModelBase
SubId string
Count int
SubData *Sub `pg:"rel:has-one"`
}
//go:generate gmodel -typeName=AutoData -tableName=auto_datas
//go:generate gdao -typeName=AutoData -tableName=auto_datas -daoPackage=dao -useGorm=true
type AutoData struct {
db.AutoModelBase
Name string
Age int8
}