1
This commit is contained in:
parent
a019d531c4
commit
bfff40dccd
9
bin/gamesapi/config/confdb.mysql.json
Normal file
9
bin/gamesapi/config/confdb.mysql.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"host": "mysql-test.kingsome.cn",
|
||||
"port": 3306,
|
||||
"user": "root",
|
||||
"passwd": "keji178",
|
||||
"database": "confdb_dev_1",
|
||||
"max_open_conns": 1,
|
||||
"max_idle_conns": 1
|
||||
}
|
15
server/gamesapi/mt/ConfDb.go
Normal file
15
server/gamesapi/mt/ConfDb.go
Normal file
@ -0,0 +1,15 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type ConfDb struct {
|
||||
mtb.ConfDb
|
||||
}
|
||||
|
||||
type ConfDbTable struct {
|
||||
f5.IdMetaTable[ConfDb]
|
||||
selfConf *ConfDb
|
||||
}
|
@ -7,6 +7,7 @@ import (
|
||||
type table struct {
|
||||
GamesapiCluster *GamesapiClusterTable
|
||||
Config *ConfigTable
|
||||
ConfDb *ConfDbTable
|
||||
}
|
||||
|
||||
var Table = f5.New(func(this *table) {
|
||||
@ -19,4 +20,10 @@ var Table = f5.New(func(this *table) {
|
||||
this.FileName = "../config/config.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.ConfDb = f5.New(func(this *ConfDbTable) {
|
||||
this.FileName = "../config/confdb.mysql.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
})
|
||||
|
@ -27,6 +27,19 @@ type Config struct {
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type ConfDb struct {
|
||||
host string
|
||||
port int32
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
max_open_conns int32
|
||||
max_idle_conns int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
func (this *GamesapiCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
@ -115,6 +128,62 @@ func (this *Config) HasRedirectSecretKey() bool {
|
||||
return (this._flags1_ & (uint64(1) << 8)) > 0
|
||||
}
|
||||
|
||||
func (this *ConfDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
|
||||
func (this *ConfDb) HasHost() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *ConfDb) GetPort() int32 {
|
||||
return this.port
|
||||
}
|
||||
|
||||
func (this *ConfDb) HasPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *ConfDb) GetUser() string {
|
||||
return this.user
|
||||
}
|
||||
|
||||
func (this *ConfDb) HasUser() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *ConfDb) GetPasswd() string {
|
||||
return this.passwd
|
||||
}
|
||||
|
||||
func (this *ConfDb) HasPasswd() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *ConfDb) GetDatabase() string {
|
||||
return this.database
|
||||
}
|
||||
|
||||
func (this *ConfDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *ConfDb) GetMaxOpenConns() int32 {
|
||||
return this.max_open_conns
|
||||
}
|
||||
|
||||
func (this *ConfDb) HasMaxOpenConns() bool {
|
||||
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||
}
|
||||
|
||||
func (this *ConfDb) GetMaxIdleConns() int32 {
|
||||
return this.max_idle_conns
|
||||
}
|
||||
|
||||
func (this *ConfDb) HasMaxIdleConns() bool {
|
||||
return (this._flags1_ & (uint64(1) << 7)) > 0
|
||||
}
|
||||
|
||||
|
||||
func (this *GamesapiCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||
@ -132,3 +201,13 @@ func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.request_over_time, "request_over_time", &this._flags1_, 7, kv)
|
||||
f5.ReadMetaTableField(&this.redirect_secret_key, "redirect_secret_key", &this._flags1_, 8, kv)
|
||||
}
|
||||
|
||||
func (this *ConfDb) 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)
|
||||
f5.ReadMetaTableField(&this.max_open_conns, "max_open_conns", &this._flags1_, 6, kv)
|
||||
f5.ReadMetaTableField(&this.max_idle_conns, "max_idle_conns", &this._flags1_, 7, kv)
|
||||
}
|
||||
|
@ -20,3 +20,14 @@ message Config
|
||||
optional int32 request_over_time = 7;
|
||||
optional string redirect_secret_key = 8;
|
||||
}
|
||||
|
||||
message ConfDb
|
||||
{
|
||||
optional string host = 1;
|
||||
optional int32 port = 2;
|
||||
optional string user = 3;
|
||||
optional string passwd = 4;
|
||||
optional string database = 5;
|
||||
optional int32 max_open_conns = 6;
|
||||
optional int32 max_idle_conns = 7;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user