db

package
v1.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPlayerIdWithUID

func GetPlayerIdWithUID(uid int64) int64

func GetPlayerIds

func GetPlayerIds(playerIds []int64) []int64

GetPlayerIds 批量查询玩家id(过滤不存在的)

func GetPlayerName

func GetPlayerName(playerId int64) string

GetPlayerName 获取玩家角色名

func PlayerNameIsExist

func PlayerNameIsExist(playerName string) (int64, bool)

PlayerNameIsExist 玩家角色名全局唯一

Types

type Component

type Component struct {
	cherryFacade.Component
}

func New

func New() *Component

func (*Component) Init

func (c *Component) Init()

Init 组件初始化函数 为了简化部署的复杂性,本示例取消了数据库连接相关的逻辑

func (*Component) Name

func (c *Component) Name() string

func (*Component) OnAfterInit

func (c *Component) OnAfterInit()

func (*Component) OnStop

func (*Component) OnStop()

type PlayerTable

type PlayerTable struct {
	PID            int32  `gorm:"column:pid;comment:'平台id'" json:"pid"`
	OpenId         string `gorm:"column:open_id;comment:'平台open_id'" json:"openId"`
	UID            int64  `gorm:"column:uid;comment:'用户id'" json:"uid"`
	ServerId       int32  `gorm:"column:server_id;comment:'创角时的游戏服id'" json:"serverId"`
	MergedServerId int32  `gorm:"column:merged_server_id;comment:'合服后的游戏服id'" json:"mergedServerId"`
	PlayerId       int64  `gorm:"column:player_id;primary_key;comment:'角色id'" json:"playerId"`
	Name           string `gorm:"column:player_name;comment:'角色名称'" json:"name"`
	Gender         int32  `gorm:"column:gender;comment:'角色性别'" json:"gender"`
	Level          int32  `gorm:"column:level;comment:'角色等级'" json:"level"`
	Exp            int64  `gorm:"column:exp;comment:'角色经验'" json:"exp"`
	CreateTime     int64  `gorm:"column:create_time;comment:'创建时间'" json:"createTime"`
}

PlayerTable 角色基础表

func CreatePlayer

func CreatePlayer(session *cproto.Session, name string, serverId int32, playerInit *data.PlayerInitRow) (*PlayerTable, int32)

func GetPlayerTable

func GetPlayerTable(playerId int64) (*PlayerTable, bool)

func (*PlayerTable) InThisServerId

func (p *PlayerTable) InThisServerId() int32

InThisServerId 角色当前正在的游戏服(合服后serverId会变)

func (*PlayerTable) TableName

func (*PlayerTable) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL