2024-08-02 18:41:34 +08:00

105 lines
2.6 KiB
Go

package model
import "shylinux.com/x/mysql-story/src/db"
const (
ID = "id"
UID = "uid"
NAME = "name"
INFO = "info"
TYPE = "type"
ROLE = "role"
STATUS = "status"
ADDRESS = "address"
EMAIL = "email"
AVATAR = "avatar"
OPEN_ID = "open_id"
USER_UID = "user_uid"
USER_NAME = "user_name"
USER_AVATAR = "user_avatar"
USER_PLACE_ROLE = "user_place_role"
PLACE_UID = "place_uid"
PLACE_NAME = "place_name"
PLACE_TYPE = "place_type"
PLACE_ADDRESS = "place_address"
STREET_NAME = "street_name"
STREET_UID = "street_uid"
CITY_NAME = "city_name"
CITY_UID = "city_uid"
APPLY_UID = "apply_uid"
APPLY_STATUS = "apply_status"
ORDER_STATUS = "order_status"
ORDER_UID = "order_uid"
CREATED_AT = "created_at"
OPERATE = "operate"
BEGIN_TIME = "begin_time"
END_TIME = "end_time"
)
type Sess struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32)"`
IP string `gorm:"type:char(16)"`
Agent string `gorm:"size:char(256)"`
}
type User struct {
db.ModelWithUID
OpenID string `gorm:"type:char(32)";index`
Email string `gorm:"type:char(32)"`
Name string `gorm:"type:char(32)"`
Avatar string `gorm:"size:256"`
}
type UserPlace struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
PlaceUID string `gorm:"type:char(32)"`
Role uint8
BeginTime db.Time
EndTime db.Time
}
type Place struct {
db.ModelWithUID
StreetUID string `gorm:"type:char(32)"`
Name string `gorm:"type:char(32)"`
Address string `gorm:"size:256"`
Type uint8
}
type Street struct {
db.ModelWithUID
CityUID string `gorm:"type:char(32)"`
Name string `gorm:"type:char(32);index"`
}
type City struct {
db.ModelWithUID
Name string `gorm:"type:char(32);index"`
}
type Event struct {
db.ModelWithUID
PlaceUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)";index`
Index string `gorm:"type:char(32)"`
Operate string `gorm:"type:char(32)"`
Args string `gorm:"type:char(32)"`
Info string `gorm:"size:1024"`
}
type Apply struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
PlaceUID string `gorm:"type:char(32)"`
Status uint8
Role uint8
BeginTime db.Time
EndTime db.Time
}
type Order struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
ApplyUID string `gorm:"type:char(32);index"`
Status uint8
}
func init() {
db.CmdModels("", &Sess{}, &User{}, &UserPlace{}, &Place{}, &Street{}, &City{}, Event{}, Apply{}, Order{})
}