database

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MailAvatar   = 1 // 角色
	MailMaterial = 2 // 材料
)

邮件奖励类型

Variables

This section is empty.

Functions

func AddAccountFieldByFieldName added in v1.3.0

func AddAccountFieldByFieldName(db *gorm.DB, account *Account) (uint32, error)

添加新账号

func AddDatePlayerFieldByFieldName added in v1.3.0

func AddDatePlayerFieldByFieldName(db *gorm.DB, player *PlayerData) error

添加新账号数据

func DelAcceptApplyFriend added in v1.2.2

func DelAcceptApplyFriend(rc *redis.Client, uid uint32)

删除玩家待加入数据库好友信息

func GetAcceptApplyFriend added in v1.2.2

func GetAcceptApplyFriend(rc *redis.Client, uid uint32) ([]byte, bool)

获取玩家待加入数据库好友信息

func GetAllMail added in v1.3.0

func GetAllMail() map[uint32]*Mail

func GetComboTokenByAccountId added in v1.3.0

func GetComboTokenByAccountId(rc *redis.Client, accountId string) string

获取ComboToken

func GetDbConf added in v1.3.0

func GetDbConf(db *gorm.DB)

func GetPlayerFriend added in v1.2.2

func GetPlayerFriend(rc *redis.Client, uid uint32) ([]byte, bool)

获取玩家好友申请信息

func IsOverlapping added in v1.3.0

func IsOverlapping(rogueMap []*RogueConf) bool

func NewMysql

func NewMysql(dsn string) *gorm.DB

func NewRedis

func NewRedis(addr, password string, db int) *redis.Client

func NewSqlite added in v1.3.0

func NewSqlite(dsn string) *gorm.DB

func SetAcceptApplyFriend added in v1.2.2

func SetAcceptApplyFriend(rc *redis.Client, uid uint32, value []byte) bool

设置玩家待加入数据库好友信息

func SetComboTokenByAccountId added in v1.3.0

func SetComboTokenByAccountId(rc *redis.Client, accountId, comboToken string) string

设置ComboToken

func SetPlayerFriend added in v1.2.2

func SetPlayerFriend(rc *redis.Client, uid uint32, value []byte) bool

设置玩家好友申请信息

func UpdateAccountFieldByFieldName added in v1.3.0

func UpdateAccountFieldByFieldName(db *gorm.DB, account *Account) error

更新账号

func UpdateBlockData added in v1.3.0

func UpdateBlockData(db *gorm.DB, blockData *BlockData) error

更新地图文件

func UpdatePlayer added in v1.3.0

func UpdatePlayer(db *gorm.DB, player *PlayerData) error

更新账号

func UpdatePlayerBasic added in v1.3.0

func UpdatePlayerBasic(db *gorm.DB, player *PlayerBasic) bool

更新账号简要数据

Types

type Account

type Account struct {
	AccountId  uint32 `gorm:"primarykey;AUTO_INCREMENT"`
	Username   string
	Token      string
	ComboToken string
	CreateTime int64
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

func QueryAccountByFieldAccountId added in v1.3.0

func QueryAccountByFieldAccountId(db *gorm.DB, AccountId uint32) *Account

func QueryAccountByFieldUsername added in v1.3.0

func QueryAccountByFieldUsername(db *gorm.DB, Username string) *Account

查询账号

type BlockData added in v1.2.2

type BlockData struct {
	Uid         uint32 `gorm:"primaryKey"`
	EntryId     uint32 `gorm:"primaryKey"`
	DataVersion uint32
	BinData     []byte
}

func GetBlockData added in v1.3.0

func GetBlockData(db *gorm.DB, uid, entryId uint32) *BlockData

拉取地图文件

type DbConf added in v1.3.0

type DbConf struct {
	MailMap map[uint32]*Mail

	RogueMap map[uint32]*RogueConf
	// contains filtered or unexported fields
}
var DBCONF *DbConf

type Item added in v1.2.2

type Item struct {
	ItemType uint32 // 类型
	ItemId   uint32 // id
	Num      uint32 // 数量
}

type Mail

type Mail struct {
	Id        uint32       `gorm:"primarykey;AUTO_INCREMENT"` // 邮件id
	Title     string       // 邮件标题
	Sender    string       // 发件人
	BeginTime sql.NullTime // 开始时间
	EndTime   sql.NullTime // 结束时间
	Content   string       // 内容
	Item      string       // 邮件附件
	ItemList  []*Item      `gorm:"-"`
}

全服邮件

func GetDbAllMail added in v1.3.0

func GetDbAllMail(db *gorm.DB) []*Mail

拉取全部邮件

func GetMailById added in v1.3.0

func GetMailById(id uint32) *Mail

type PlayerBasic added in v1.3.0

type PlayerBasic struct {
	Uid     uint32 `gorm:"primaryKey"`
	BinData []byte
}

type PlayerData

type PlayerData struct {
	Uid         uint32 `gorm:"primarykey"`
	Nickname    string
	Level       uint32
	Exp         uint32
	DataVersion uint32
	BinData     []byte
}

func QueryAccountUidByFieldPlayer added in v1.3.0

func QueryAccountUidByFieldPlayer(db *gorm.DB, uid uint32) *PlayerData

使用账号id拉取数据

type PlayerUid

type PlayerUid struct {
	Uid          uint32 `gorm:"primarykey;AUTO_INCREMENT"`
	AccountType  uint32
	AccountId    uint32
	CreateTime   int64
	IsBan        bool
	BanBeginTime int64
	BanEndTime   int64
	BanMsg       string
}

func GetPlayerUidByAccountId added in v1.3.0

func GetPlayerUidByAccountId(db *gorm.DB, AccountId uint32) *PlayerUid

使用account id拉取数据

func UpdatePlayerUid added in v1.3.0

func UpdatePlayerUid(db *gorm.DB, AccountId uint32) *PlayerUid

指定account id 创建数据

type RogueConf added in v1.2.3

type RogueConf struct {
	SeasonId  uint32 `gorm:"primarykey;AUTO_INCREMENT"`
	BeginTime sql.NullTime
	EndTime   sql.NullTime
}

func GetAllRogue added in v1.3.0

func GetAllRogue(db *gorm.DB) []*RogueConf

拉取全部模拟宇宙

func GetCurRogue added in v1.3.0

func GetCurRogue() *RogueConf

type ScheduleConf added in v1.2.3

type ScheduleConf struct {
	ScheduleId uint32 `gorm:"primarykey;AUTO_INCREMENT"`
	BeginTime  sql.NullTime
	EndTime    sql.NullTime
}

type ServerConf added in v1.2.2

type ServerConf struct {
	AutoCreate bool // 是否自动注册
}

type TimeInterval added in v1.3.0

type TimeInterval struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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