-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentity.go
47 lines (39 loc) · 919 Bytes
/
entity.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
package main
import "time"
type Pet struct {
Id uint64 `db:"id"`
Type string `db:"type"`
}
func (*Pet) TableName() string {
return "t_pet"
}
type Cat struct {
Id uint64 `db:"id"`
Name string `db:"name"`
PetId uint64 `db:"pet_id"`
Age uint `db:"age"`
Color string `db:"color"`
Weight float64 `db:"weight"`
IsSold *bool `db:"is_sold"`
Price *float64 `db:"price"`
CreateAt time.Time `db:"create_at"`
}
type CatRo struct {
Name string `json:"name, string"`
IsSold *bool `json:"isSold, *bool"`
Price *float64 `json:"price, *float64"`
Age uint `json:"age", unit`
}
func (*Cat) TableName() string {
return "t_cat_go"
}
type Dog struct {
Id uint64 `db:"id"`
Age int `db:"age"`
PetId uint64 `db:"pet_id"`
Weight float64 `db:"weight"`
Height int32 `db:"height"`
}
func (*Dog) TableName() string {
return "t_dog"
}