diff --git a/server/imserver/mt/GameDb.go b/server/imserver/mt/GameDb.go new file mode 100644 index 00000000..770a231f --- /dev/null +++ b/server/imserver/mt/GameDb.go @@ -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() { +} + diff --git a/server/imserver/mt/export.go b/server/imserver/mt/export.go index f149323f..1dfa9f5a 100644 --- a/server/imserver/mt/export.go +++ b/server/imserver/mt/export.go @@ -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 = "" + }); + }) diff --git a/server/imserver/mtb/mtb.auto_gen.go b/server/imserver/mtb/mtb.auto_gen.go index 86fbfda8..2733ccf1 100644 --- a/server/imserver/mtb/mtb.auto_gen.go +++ b/server/imserver/mtb/mtb.auto_gen.go @@ -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) +} diff --git a/server/imserver/proto/mt.proto b/server/imserver/proto/mt.proto index 70d72064..3bc665d0 100644 --- a/server/imserver/proto/mt.proto +++ b/server/imserver/proto/mt.proto @@ -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; +}