1
This commit is contained in:
parent
ad45f61cb0
commit
8c365d3a57
19
server/imserver/mt/GameDb.go
Normal file
19
server/imserver/mt/GameDb.go
Normal file
@ -0,0 +1,19 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type GameDb struct {
|
||||
mtb.GameDb
|
||||
}
|
||||
|
||||
type GameDbTable struct {
|
||||
f5.IdMetaTable[GameDb]
|
||||
selfConf *GameDb
|
||||
}
|
||||
|
||||
func (this *GameDb) Init1() {
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
type table struct {
|
||||
IMCluster *IMClusterTable
|
||||
MasterCluster *MasterClusterTable
|
||||
GameDb *GameDbTable
|
||||
}
|
||||
|
||||
var Table = f5.New(func (this* table) {
|
||||
@ -20,4 +21,9 @@ var Table = f5.New(func (this* table) {
|
||||
this.PrimKey = ""
|
||||
});
|
||||
|
||||
this.GameDb = f5.New(func (this *GameDbTable) {
|
||||
this.FileName = "../config/gamedb.mysql.json"
|
||||
this.PrimKey = ""
|
||||
});
|
||||
|
||||
})
|
||||
|
@ -22,6 +22,17 @@ type MasterCluster struct {
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type GameDb struct {
|
||||
host string
|
||||
port int32
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
func (this *IMCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
@ -70,6 +81,46 @@ func (this *MasterCluster) HasListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
|
||||
func (this *GameDb) HasHost() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetPort() int32 {
|
||||
return this.port
|
||||
}
|
||||
|
||||
func (this *GameDb) HasPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetUser() string {
|
||||
return this.user
|
||||
}
|
||||
|
||||
func (this *GameDb) HasUser() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetPasswd() string {
|
||||
return this.passwd
|
||||
}
|
||||
|
||||
func (this *GameDb) HasPasswd() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetDatabase() string {
|
||||
return this.database
|
||||
}
|
||||
|
||||
func (this *GameDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
|
||||
func (this *IMCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||
@ -82,3 +133,11 @@ func (this *MasterCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.ip, "ip", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 3, kv)
|
||||
}
|
||||
|
||||
func (this *GameDb) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.user, "user", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.passwd, "passwd", &this._flags1_, 4, kv)
|
||||
f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv)
|
||||
}
|
||||
|
@ -15,3 +15,12 @@ message MasterCluster
|
||||
optional string ip = 2;
|
||||
optional int32 listen_port = 3;
|
||||
}
|
||||
|
||||
message GameDb
|
||||
{
|
||||
optional string host = 1;
|
||||
optional int32 port = 2;
|
||||
optional string user = 3;
|
||||
optional string passwd = 4;
|
||||
optional string database = 5;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user