GameDB

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAccountType  = 2
	DefaultAccountState = 1
)
View Source
const (
	DefaultUserIdCollectionName     = "user_id"
	DefaultUserCollectionName       = "users"
	BlackListCollectionName         = "black_list"
	WhiteListCollectionName         = "white_list"
	ServerWeightCollectionName      = "server_weight"
	UserServerCollectionName        = "uid_sid"
	GameServerSessionCollectionName = "gs_session"
	ServerListCollectionName        = "server_list"
)

Variables

View Source
var (
	UserIds *UserIdObject
	Users   *UserObject
)

Functions

func InitDB

func InitDB()

Types

type ConfigDocument

type ConfigDocument struct {
	Id       uint64 "_id"
	ServerId uint32 "server_id"
}

配置

type DBObject

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

数据库父类

type GamServerSessionDocument

type GamServerSessionDocument struct {
	Sid        int64     "_id"
	ExpireTime time.Time "expire_time"
	IP         string    "ip"
	Port       string    "port"
}

GameServerSession

type GamServerSessionObject

type GamServerSessionObject struct {
	DBObject
	// contains filtered or unexported fields
}
var (
	GamServerSession *GamServerSessionObject
)

func (*GamServerSessionObject) ForEach

func (object *GamServerSessionObject) ForEach(callback func(document *GamServerSessionDocument))

迭代名单

func (*GamServerSessionObject) GetById

* @brief 通过id获取

func (*GamServerSessionObject) Init

func (object *GamServerSessionObject) Init(dbName, collectionName string)

* @brief 初始化

func (*GamServerSessionObject) UpsertWithId

func (object *GamServerSessionObject) UpsertWithId(id int64, update interface{}) error

更新

type IdDocument

type IdDocument struct {
	Id     uint64 "_id"
	NextId uint32 "next_id"
}

id

type ListDocument

type ListDocument struct {
	ID    string "_id"
	Value string "value"
}

type ListObject

type ListObject struct {
	DBObject
	// contains filtered or unexported fields
}
var (
	BlackListObject *ListObject
	WhiteListObject *ListObject
)

func (*ListObject) Init

func (object *ListObject) Init(dbName, collectionName string)

* @brief 初始化

func (*ListObject) IsInList

func (object *ListObject) IsInList(value string) bool

func (*ListObject) RemoveAll

func (object *ListObject) RemoveAll() error

func (*ListObject) RemoveById

func (object *ListObject) RemoveById(id string) error

func (*ListObject) UpsertListWithId

func (object *ListObject) UpsertListWithId(id string, update interface{}) error

更新

type ServerListDocument

type ServerListDocument struct {
	ID               int64  "_id"
	SName            string "sname"
	KingLeague       string "king_league"
	King             string "king"
	ServerInitTime   uint64 "protect_time"
	Status           int32  "status"
	WhiteList        int32  "white_list"
	SAddr            string "saddr"
	KingServerName   string "kingservername"
	KingLeagueSlogan string "kingleagueslogan"
	CanMoveIn        bool   "canmovein"
	Online           uint32 "online"
}

type ServerListObject

type ServerListObject struct {
	DBObject
	// contains filtered or unexported fields
}
var (
	ServerListDBObject *ServerListObject
)

func (*ServerListObject) ForEach

func (object *ServerListObject) ForEach(callback func(document *ServerListDocument))

func (*ServerListObject) GetServerInfo

func (object *ServerListObject) GetServerInfo(sid int64) *ServerListDocument

func (*ServerListObject) Init

func (object *ServerListObject) Init(dbName, collectionName string)

* @brief 初始化

func (*ServerListObject) UpdateServerInfoKV

func (object *ServerListObject) UpdateServerInfoKV(id uint32, key string, value interface{}) error

更新单个字段

func (*ServerListObject) UpsertServerInfoWithId

func (object *ServerListObject) UpsertServerInfoWithId(id int64, update interface{}) error

更新

type ServerWeight

type ServerWeight struct {
	SID    int64 "sid"
	Weight int64 "weight"
}

type ServerWeightDocument

type ServerWeightDocument struct {
	ID    uint64         "_id"
	Array []ServerWeight "weight_array"
}

type ServerWeightObject

type ServerWeightObject struct {
	DBObject
	// contains filtered or unexported fields
}
var (
	ServerWeightObjectInstance *ServerWeightObject
)

func (*ServerWeightObject) GetById

func (object *ServerWeightObject) GetById(id uint64) (error, *ServerWeightDocument)

* @brief 通过id获取

func (*ServerWeightObject) Init

func (object *ServerWeightObject) Init(dbName, collectionName string)

* @brief 初始化

func (*ServerWeightObject) UpsertWithId

func (object *ServerWeightObject) UpsertWithId(id uint64, update interface{}) error

* @brief 更新

type User

type User struct {
	Id             uint64 "_id"
	AccountId      uint64 `json:"accountid,omitempty" bson:"accountid,omitempty"`
	Name           string `json:"name,omitempty" bson:"name,omitempty"`
	GoogleName     string `json:"google_name,omitempty" bson:"google_name,omitempty"`
	FaceBookName   string `json:"fb_name,omitempty" bson:"fb_name,omitempty"`
	TwitterName    string `json:"twitter_name,omitempty" bson:"twitter_name,omitempty"`
	DeviceId       string `json:"device_id,omitempty" bson:"device_id,omitempty"`
	GameCenterName string `json:"gamecenter_name,omitempty" bson:"gamecenter_name,omitempty"`
	CmderName      string `json:"cmdername,omitempty" bson:"cmdername,omitempty"`
	HeaderId       uint32 `json:"headerid,omitempty" bson:"headerid,omitempty"`
	HeaderUrl      string `json:"headerurl,omitempty" bson:"headerurl,omitempty"`
	AvatarBoxID    uint32 `json:"avatarboxid,omitempty" bson:"avatarboxid,omitempty"`
	MainCityLevel  uint32 `json:"maincitylevel,omitempty" bson:"maincitylevel,omitempty"`
	CreateTime     uint32 `json:"createtime,omitempty" bson:"createtime,omitempty"`
	LastLoginTime  uint32 `json:"lastswitchtime,omitempty" bson:"lastswitchtime,omitempty"`
	Sid            uint32 `json:"sid,omitempty" bson:"sid,omitempty"`
	CurrentSid     uint32 `json:"currentSid,omitempty" bson:"currentSid,omitempty"`
}

type UserId

type UserId struct {
	Id     uint64 "_id"
	NextId uint64 "next_id"
}

type UserIdObject

type UserIdObject struct {
	DBObject
	// contains filtered or unexported fields
}

func (*UserIdObject) Init

func (object *UserIdObject) Init(dbName, collectionName string)

* @brief 初始化

func (*UserIdObject) NextId

func (object *UserIdObject) NextId() (error, uint64)

type UserObject

type UserObject struct {
	DBObject
	// contains filtered or unexported fields
}

func (*UserObject) CreateUserWithDefaultParam

func (object *UserObject) CreateUserWithDefaultParam(name, password string, accountid uint64) (error, *User)

* @brief 创建

func (*UserObject) ForEach

func (object *UserObject) ForEach(callback func(document *User))

func (*UserObject) Get

func (object *UserObject) Get(loginType proto.LoginType, name string) (error, *User)

* @brief 获取

func (*UserObject) GetByAccount

func (object *UserObject) GetByAccount(id uint64) (error, *[]User)

* @brief 获取

func (*UserObject) GetById

func (object *UserObject) GetById(id uint64) (error, *User)

* @brief 获取

func (*UserObject) GetByIds

func (object *UserObject) GetByIds(ids []uint64) (error, []User)

func (*UserObject) GetByName

func (object *UserObject) GetByName(loginType proto.LoginType, name string) (error, *User)

* @brief 获取

func (*UserObject) Init

func (object *UserObject) Init(dbName, collectionName string)

* @brief 初始化

func (*UserObject) UpdateUserById

func (object *UserObject) UpdateUserById(uid uint64, doc *User) error

func (*UserObject) UpsertById

func (object *UserObject) UpsertById(id uint64, update bson.M) (error, bool)

* @brief 更新

type UserServerDocument

type UserServerDocument struct {
	ID  uint64 "_id"
	SID int64  "sid"
}

type UserServerObject

type UserServerObject struct {
	DBObject
	// contains filtered or unexported fields
}
var (
	UserServerDBObject *UserServerObject
)

func (*UserServerObject) GetById

func (object *UserServerObject) GetById(id uint64) (error, *UserServerDocument)

func (*UserServerObject) Init

func (object *UserServerObject) Init(dbName, collectionName string)

* @brief 初始化

func (*UserServerObject) UpsertWithId

func (object *UserServerObject) UpsertWithId(id uint64, update interface{}) error

更新

Jump to

Keyboard shortcuts

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