mirror of
https://shylinux.com/x/community
synced 2025-04-26 01:54:05 +08:00
125 lines
3.3 KiB
Go
125 lines
3.3 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"
|
|
TABLES = "tables"
|
|
ADDRESS = "address"
|
|
CONTENT = "content"
|
|
EMAIL = "email"
|
|
AVATAR = "avatar"
|
|
OPERATE = "operate"
|
|
OPERATOR = "operator"
|
|
CREATED_AT = "created_at"
|
|
UPDATED_AT = "updated_at"
|
|
BEGIN_TIME = "begin_time"
|
|
END_TIME = "end_time"
|
|
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_UID = "street_uid"
|
|
STREET_NAME = "street_name"
|
|
CITY_UID = "city_uid"
|
|
CITY_NAME = "city_name"
|
|
EVENT_UID = "event_uid"
|
|
APPLY_UID = "apply_uid"
|
|
APPLY_STATUS = "apply_status"
|
|
ORDER_UID = "order_uid"
|
|
ORDER_STATUS = "order_status"
|
|
)
|
|
|
|
type Sess struct {
|
|
db.ModelWithUID
|
|
UserUID string `gorm:"type:char(32)"`
|
|
IP string `gorm:"type:char(16)"`
|
|
Agent string `gorm:"type:varchar(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:"type:varchar(256)"`
|
|
}
|
|
type UserPlace struct {
|
|
db.ModelWithUID
|
|
UserUID string `gorm:"type:char(32);index"`
|
|
PlaceUID string `gorm:"type:char(32);index"`
|
|
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:"type:varchar(256)"`
|
|
Type uint8
|
|
}
|
|
type Street struct {
|
|
db.ModelWithUID
|
|
CityUID string `gorm:"type:char(32);index"`
|
|
Name string `gorm:"type:char(32);index"`
|
|
Info string
|
|
}
|
|
type City struct {
|
|
db.ModelWithUID
|
|
Name string `gorm:"type:char(32);index"`
|
|
}
|
|
|
|
type Service struct {
|
|
db.ModelWithUID
|
|
Icon string `gorm:"type:char(32)"`
|
|
Name string `gorm:"type:char(32)"`
|
|
Index string `gorm:"type:char(32)"`
|
|
Hostname string `gorm:"type:char(32)"`
|
|
Pathname string `gorm:"type:char(255)"`
|
|
Nodename string `gorm:"type:char(32)"`
|
|
Nodetype string `gorm:"type:char(32)"`
|
|
Domain string `gorm:"type:char(255)"`
|
|
Module string `gorm:"type:char(32)"`
|
|
Version string `gorm:"type:char(32)"`
|
|
}
|
|
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
|
|
}
|
|
type Apply struct {
|
|
db.ModelWithUID
|
|
UserUID string `gorm:"type:char(32);index"`
|
|
PlaceUID string `gorm:"type:char(32);index"`
|
|
Tables 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)"`
|
|
Status uint8
|
|
}
|
|
|
|
func init() {
|
|
db.CmdModels("", &Sess{}, &User{}, &UserPlace{}, &Place{}, &Street{}, &City{}, Event{}, Apply{}, Order{}, Service{})
|
|
}
|