Documentation ¶
Index ¶
- Constants
- Variables
- func InitDB()
- type ConfigDocument
- type DBObject
- type GamServerSessionDocument
- type GamServerSessionObject
- func (object *GamServerSessionObject) ForEach(callback func(document *GamServerSessionDocument))
- func (object *GamServerSessionObject) GetById(id int64) (error, *GamServerSessionDocument)
- func (object *GamServerSessionObject) Init(dbName, collectionName string)
- func (object *GamServerSessionObject) UpsertWithId(id int64, update interface{}) error
- type IdDocument
- type ListDocument
- type ListObject
- type ServerListDocument
- type ServerListObject
- func (object *ServerListObject) ForEach(callback func(document *ServerListDocument))
- func (object *ServerListObject) GetServerInfo(sid int64) *ServerListDocument
- func (object *ServerListObject) Init(dbName, collectionName string)
- func (object *ServerListObject) UpdateServerInfoKV(id uint32, key string, value interface{}) error
- func (object *ServerListObject) UpsertServerInfoWithId(id int64, update interface{}) error
- type ServerWeight
- type ServerWeightDocument
- type ServerWeightObject
- type User
- type UserId
- type UserIdObject
- type UserObject
- func (object *UserObject) CreateUserWithDefaultParam(name, password string, accountid uint64) (error, *User)
- func (object *UserObject) ForEach(callback func(document *User))
- func (object *UserObject) Get(loginType proto.LoginType, name string) (error, *User)
- func (object *UserObject) GetByAccount(id uint64) (error, *[]User)
- func (object *UserObject) GetById(id uint64) (error, *User)
- func (object *UserObject) GetByIds(ids []uint64) (error, []User)
- func (object *UserObject) GetByName(loginType proto.LoginType, name string) (error, *User)
- func (object *UserObject) Init(dbName, collectionName string)
- func (object *UserObject) UpdateUserById(uid uint64, doc *User) error
- func (object *UserObject) UpsertById(id uint64, update bson.M) (error, bool)
- type UserServerDocument
- type UserServerObject
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 ¶
Types ¶
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 ¶
func (object *GamServerSessionObject) GetById(id int64) (error, *GamServerSessionDocument)
* @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 ListDocument ¶
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 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 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) GetByAccount ¶
func (object *UserObject) GetByAccount(id uint64) (error, *[]User)
* @brief 获取
func (*UserObject) GetById ¶
func (object *UserObject) GetById(id uint64) (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 ¶
* @brief 更新
type UserServerDocument ¶
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
更新
Click to show internal directories.
Click to hide internal directories.