1
This commit is contained in:
parent
567d5386d0
commit
82bd39e60e
@ -10,3 +10,5 @@ CREATE TABLE `t_xxx` (
|
||||
|
||||
表字段没特别原因下,必须有默认值
|
||||
表名称t_开始
|
||||
|
||||
node ../../tools/pbtools/app.js
|
||||
|
15
server/imserver/mt/Config.go
Normal file
15
server/imserver/mt/Config.go
Normal file
@ -0,0 +1,15 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
mtb.Config
|
||||
}
|
||||
|
||||
type ConfigTable struct {
|
||||
f5.IdMetaTable[Config]
|
||||
selfConf *Config
|
||||
}
|
15
server/imserver/mt/FriendDb.go
Normal file
15
server/imserver/mt/FriendDb.go
Normal file
@ -0,0 +1,15 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type FriendDb struct {
|
||||
mtb.FriendDb
|
||||
}
|
||||
|
||||
type FriendDbTable struct {
|
||||
f5.IdMetaTable[FriendDb]
|
||||
selfConf *FriendDb
|
||||
}
|
@ -8,6 +8,8 @@ type table struct {
|
||||
IMCluster *IMClusterTable
|
||||
MasterCluster *MasterClusterTable
|
||||
GameDb *GameDbTable
|
||||
FriendDb *FriendDbTable
|
||||
Config *ConfigTable
|
||||
}
|
||||
|
||||
var Table = f5.New(func (this* table) {
|
||||
@ -26,4 +28,13 @@ var Table = f5.New(func (this* table) {
|
||||
this.PrimKey = ""
|
||||
});
|
||||
|
||||
this.FriendDb = f5.New(func (this *FriendDbTable) {
|
||||
this.FileName = "../config/frienddb.mysql.json"
|
||||
this.PrimKey = ""
|
||||
});
|
||||
|
||||
this.Config = f5.New(func (this *ConfigTable) {
|
||||
this.FileName = "../config/config.json"
|
||||
this.PrimKey = ""
|
||||
});
|
||||
})
|
||||
|
@ -33,6 +33,24 @@ type GameDb struct {
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type FriendDb struct {
|
||||
host string
|
||||
port int32
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
gameapi_url string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
func (this *IMCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
@ -121,6 +139,54 @@ func (this *GameDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasHost() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetPort() int32 {
|
||||
return this.port
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetUser() string {
|
||||
return this.user
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasUser() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetPasswd() string {
|
||||
return this.passwd
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasPasswd() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetDatabase() string {
|
||||
return this.database
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *Config) GetGameapiUrl() string {
|
||||
return this.gameapi_url
|
||||
}
|
||||
|
||||
func (this *Config) HasGameapiUrl() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
|
||||
func (this *IMCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||
@ -141,3 +207,15 @@ func (this *GameDb) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.passwd, "passwd", &this._flags1_, 4, kv)
|
||||
f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv)
|
||||
}
|
||||
|
||||
func (this *FriendDb) 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)
|
||||
}
|
||||
|
||||
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
||||
}
|
||||
|
@ -24,3 +24,17 @@ message GameDb
|
||||
optional string passwd = 4;
|
||||
optional string database = 5;
|
||||
}
|
||||
|
||||
message FriendDb
|
||||
{
|
||||
optional string host = 1;
|
||||
optional int32 port = 2;
|
||||
optional string user = 3;
|
||||
optional string passwd = 4;
|
||||
optional string database = 5;
|
||||
}
|
||||
|
||||
message Config
|
||||
{
|
||||
optional string gameapi_url = 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user