package model

import (
	"blazing/cool"
)

const TableNameServerList = "server_list"

// 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{})
}
