1
This commit is contained in:
parent
86b5a49953
commit
b4780301b9
9
bin/marketserver/config/confdb.mysql.json
Normal file
9
bin/marketserver/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/marketserver/mt/ConfDb.go
Normal file
15
server/marketserver/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
|
||||||
|
}
|
@ -18,6 +18,7 @@ type table struct {
|
|||||||
Recharge *RechargeTable
|
Recharge *RechargeTable
|
||||||
Currency *CurrencyTable
|
Currency *CurrencyTable
|
||||||
AccountDb *AccountDbTable
|
AccountDb *AccountDbTable
|
||||||
|
ConfDb *ConfDbTable
|
||||||
}
|
}
|
||||||
|
|
||||||
var Table = f5.New(func(this *table) {
|
var Table = f5.New(func(this *table) {
|
||||||
@ -46,6 +47,11 @@ var Table = f5.New(func(this *table) {
|
|||||||
this.PrimKey = ""
|
this.PrimKey = ""
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.ConfDb = f5.New(func(this *ConfDbTable) {
|
||||||
|
this.FileName = "../config/confdb.mysql.json"
|
||||||
|
this.PrimKey = ""
|
||||||
|
})
|
||||||
|
|
||||||
this.Config = f5.New(func(this *ConfigTable) {
|
this.Config = f5.New(func(this *ConfigTable) {
|
||||||
this.FileName = "../config/config.json"
|
this.FileName = "../config/config.json"
|
||||||
this.PrimKey = ""
|
this.PrimKey = ""
|
||||||
|
@ -65,6 +65,19 @@ type GameDb struct {
|
|||||||
_flags2_ uint64
|
_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
|
||||||
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
gameapi_url string
|
gameapi_url string
|
||||||
jwks_uri string
|
jwks_uri string
|
||||||
@ -374,6 +387,62 @@ func (this *GameDb) HasMaxIdleConns() bool {
|
|||||||
return (this._flags1_ & (uint64(1) << 7)) > 0
|
return (this._flags1_ & (uint64(1) << 7)) > 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 *Config) GetGameapiUrl() string {
|
func (this *Config) GetGameapiUrl() string {
|
||||||
return this.gameapi_url
|
return this.gameapi_url
|
||||||
}
|
}
|
||||||
@ -573,6 +642,16 @@ func (this *GameDb) LoadFromKv(kv map[string]interface{}) {
|
|||||||
f5.ReadMetaTableField(&this.max_idle_conns, "max_idle_conns", &this._flags1_, 7, kv)
|
f5.ReadMetaTableField(&this.max_idle_conns, "max_idle_conns", &this._flags1_, 7, 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)
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
||||||
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
||||||
f5.ReadMetaTableField(&this.jwks_uri, "jwks_uri", &this._flags1_, 2, kv)
|
f5.ReadMetaTableField(&this.jwks_uri, "jwks_uri", &this._flags1_, 2, kv)
|
||||||
|
@ -53,6 +53,17 @@ message GameDb
|
|||||||
optional int32 max_idle_conns = 7;
|
optional int32 max_idle_conns = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
message Config
|
message Config
|
||||||
{
|
{
|
||||||
optional string gameapi_url = 1;
|
optional string gameapi_url = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user