Documentation ¶
Overview ¶
Package model 数据库操作
Package model 数据库操作 ¶
Package model 玩家操作 ¶
Package model 服务器数据操作
Index ¶
- func Init(path string) error
- func Open(path string) (db *gorm.DB, err error)
- type Admin
- type Group
- func (g *Group) Create(db *gorm.DB) error
- func (g *Group) DeleteAdmin(db *gorm.DB, adminQQ int64) error
- func (g *Group) DeleteByID(db *gorm.DB) error
- func (g *Group) DeleteServer(db *gorm.DB, gameID string) error
- func (g *Group) GetByAlias(db *gorm.DB, alias string) (*Server, error)
- func (g *Group) GetByID(db *gorm.DB) (*Group, error)
- func (g *Group) IsAdmin(db *gorm.DB, qid int64) bool
- func (g *Group) IsOwner(db *gorm.DB, qid int64) bool
- func (g *Group) Update(db *gorm.DB) error
- type Player
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Admin ¶
type Admin struct { QQID int64 `gorm:"primary_key;auto_increment:false"` CreatedAt time.Time UpdatedAt time.Time }
Admin 管理表
func (*Admin) DeleteByQQID ¶ added in v1.0.2
DeleteByQQID 根据 QQID 删除 Admin 记录
type Group ¶
type Group struct { GroupID int64 `gorm:"primary_key;auto_increment:false"` Owner int64 Servers []Server `gorm:"many2many:group_servers"` Admins []Admin `gorm:"many2many:group_admins"` CreatedAt time.Time UpdatedAt time.Time }
Group 群组表
func (*Group) DeleteAdmin ¶ added in v1.0.2
DeleteAdmin 删除联表中的admin
func (*Group) DeleteByID ¶ added in v1.0.2
DeleteByID 根据 GroupID 删除 Group 记录
func (*Group) DeleteServer ¶ added in v1.0.2
DeleteServer 删除联表中的server
func (*Group) GetByAlias ¶ added in v1.1.0
GetByAlias 根据别名获取 Server 记录
type Player ¶
type Player struct { CreatedAt time.Time UpdatedAt time.Time PersonalID string // pid Qid int64 `gorm:"primary_key;auto_increment:false"` // QQ号 DisplayName string // 玩家id }
Player 玩家表
type Server ¶
type Server struct { GameID string `gorm:"primary_key"` ServerID string PGID string NameInGroup string ServerName string CreatedAt time.Time UpdatedAt time.Time }
Server 服务器表
func (*Server) DeleteByGameID ¶ added in v1.0.2
DeleteByGameID 根据 GameID 删除 Server 记录
func (*Server) GetByGameID ¶ added in v1.0.2
GetByGameID 根据 GameID 获取 Server 记录
Click to show internal directories.
Click to hide internal directories.