40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package model
|
|
|
|
import (
|
|
"blazing/cool"
|
|
)
|
|
|
|
const TableNameServerList = "server_list"
|
|
|
|
// 服务器设置天气地图|地图是否显示其他人,设置异色概率|ip
|
|
// ServerList mapped from table <server_list>
|
|
type ServerList struct {
|
|
*cool.Model
|
|
OnlineID uint16 `gorm:"column:online_id;comment:'在线ID';uniqueIndex" json:"online_id"`
|
|
//IP string `gorm:"type:varchar(16);comment:'服务器IP'" json:"ip"`
|
|
Port uint16 `gorm:"comment:'端口号,通常是小整数'" json:"port"`
|
|
//IsOpen bool `gorm:"default:true;not null;comment:'服务器是否开启,默认为开启状态'" json:"is_open"`
|
|
}
|
|
|
|
// TableName ServerList's table name
|
|
func (*ServerList) TableName() string {
|
|
return TableNameServerList
|
|
}
|
|
|
|
// GroupName ServerList's table group
|
|
func (*ServerList) GroupName() string {
|
|
return "default"
|
|
}
|
|
|
|
// NewServerList create a new ServerList
|
|
func NewServerList() *ServerList {
|
|
return &ServerList{
|
|
Model: cool.NewModel(),
|
|
}
|
|
}
|
|
|
|
// init 创建表
|
|
func init() {
|
|
cool.CreateTable(&ServerList{})
|
|
}
|