2024-08-21 11:06:37 +08:00

49 lines
1.2 KiB
Go

package model
import "shylinux.com/x/mysql-story/src/db"
const (
UID = "uid"
NAME = "name"
TYPE = "type"
ROLE = "role"
TITLE = "title"
CONTENT = "content"
USER_UID = "user_uid"
USER_GROUP_ROLE = "user_group_role"
GROUP_UID = "group_uid"
GROUP_NAME = "group_name"
GROUP_TYPE = "group_type"
COMPANY_UID = "company_uid"
COMPANY_NAME = "company_name"
CITY_UID = "city_uid"
)
type UserGroup struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
GroupUID string `gorm:"type:char(32);index"`
Role uint8
}
type Group struct {
db.ModelWithUID
CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Type uint8
}
type Company struct {
db.ModelWithUID
CityUID string `gorm:"type:char(32);index:idx_city"`
Name string `gorm:"type:varchar(64);index:idx_city"`
Info string
}
type Target struct {
db.ModelWithUID
GroupUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
Title string `gorm:"type:varchar(64)"`
Content string
}
func init() { db.CmdModels("", &UserGroup{}, &Group{}, &Company{}, &Target{}) }