-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.go
31 lines (25 loc) · 1010 Bytes
/
model.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
package main
import "time"
type breed struct {
ID int `gorm:"column:breed_id;primaryKey;not null" json:"-"`
Name string `gorm:"column:name;not null;unique" json:"name"`
Description string `gorm:"column:description;not null" json:"description"`
}
type owner struct {
ID string `gorm:"column:owner_id;primaryKey;default:uuid_generate_v4()" json:"id"`
Name string `gorm:"column:name;not null" json:"name"`
Surname string `gorm:"column:surname;not null" json:"surname"`
Birthday time.Time `gorm:"column:birthday;not null" json:"birthday"`
}
type dog struct {
ID int `gorm:"column:dog_id;primaryKey;not null" json:"-"`
Name string `gorm:"column:name;not null;index:dogs_name_owner_id_key,unique" json:"name"`
BreedID int `json:"-"`
Breed breed `json:"breed"`
OwnerID string `gorm:"index:dogs_name_owner_id_key,unique" json:"-"`
Owner owner `json:"owner"`
}
type ResponseWrap struct {
Code int `json:"code"`
Msg string `json:"message"`
}