1
This commit is contained in:
parent
375d33c789
commit
0cbc41a062
@ -3,5 +3,7 @@
|
||||
"port": 3306,
|
||||
"user": "root",
|
||||
"passwd": "keji178",
|
||||
"database": "frienddb_dev_new"
|
||||
"database": "frienddb_dev_new",
|
||||
"max_open_conns": 1,
|
||||
"max_idle_conns": 1
|
||||
}
|
||||
|
@ -3,5 +3,7 @@
|
||||
"port": 3306,
|
||||
"user": "root",
|
||||
"passwd": "keji178",
|
||||
"database": "gamedb2006_dev_1"
|
||||
"database": "gamedb2006_dev_1",
|
||||
"max_open_conns": 1,
|
||||
"max_idle_conns": 1
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package app
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/constant"
|
||||
//"main/constant"
|
||||
"mt"
|
||||
"main/middleware"
|
||||
. "main/global"
|
||||
@ -42,6 +42,7 @@ func (this *app) Update() {
|
||||
}
|
||||
|
||||
func (this *app) registerDataSources() {
|
||||
/*
|
||||
f5.GetGoStyleDb().RegisterDataSource(
|
||||
constant.MAIL_DB,
|
||||
mt.Table.MailDb.GetById(0).GetHost(),
|
||||
@ -58,6 +59,7 @@ func (this *app) registerDataSources() {
|
||||
mt.Table.MailDb.GetById(0).GetPasswd(),
|
||||
mt.Table.MailDb.GetById(0).GetDatabase(),
|
||||
1)
|
||||
*/
|
||||
}
|
||||
|
||||
func (this *app) HasTask() bool {
|
||||
|
@ -84,7 +84,9 @@ func (this *app) registerDataSources() {
|
||||
mt.Table.GameDb.GetById(0).GetUser(),
|
||||
mt.Table.GameDb.GetById(0).GetPasswd(),
|
||||
mt.Table.GameDb.GetById(0).GetDatabase(),
|
||||
1)
|
||||
1,
|
||||
mt.Table.GameDb.GetById(0).GetMaxOpenConns(),
|
||||
mt.Table.GameDb.GetById(0).GetMaxIdleConns())
|
||||
f5.GetGoStyleDb().RegisterDataSource(
|
||||
constant.GAME_DB,
|
||||
mt.Table.GameDb.GetById(0).GetHost(),
|
||||
@ -92,7 +94,9 @@ func (this *app) registerDataSources() {
|
||||
mt.Table.GameDb.GetById(0).GetUser(),
|
||||
mt.Table.GameDb.GetById(0).GetPasswd(),
|
||||
mt.Table.GameDb.GetById(0).GetDatabase(),
|
||||
1)
|
||||
1,
|
||||
mt.Table.GameDb.GetById(0).GetMaxOpenConns(),
|
||||
mt.Table.GameDb.GetById(0).GetMaxIdleConns())
|
||||
f5.GetJsStyleDb().RegisterDataSource(
|
||||
constant.FRIEND_DB,
|
||||
mt.Table.FriendDb.GetById(0).GetHost(),
|
||||
@ -100,7 +104,9 @@ func (this *app) registerDataSources() {
|
||||
mt.Table.FriendDb.GetById(0).GetUser(),
|
||||
mt.Table.FriendDb.GetById(0).GetPasswd(),
|
||||
mt.Table.FriendDb.GetById(0).GetDatabase(),
|
||||
1)
|
||||
1,
|
||||
mt.Table.FriendDb.GetById(0).GetMaxOpenConns(),
|
||||
mt.Table.FriendDb.GetById(0).GetMaxIdleConns())
|
||||
f5.GetGoStyleDb().RegisterDataSource(
|
||||
constant.FRIEND_DB,
|
||||
mt.Table.FriendDb.GetById(0).GetHost(),
|
||||
@ -108,7 +114,9 @@ func (this *app) registerDataSources() {
|
||||
mt.Table.FriendDb.GetById(0).GetUser(),
|
||||
mt.Table.FriendDb.GetById(0).GetPasswd(),
|
||||
mt.Table.FriendDb.GetById(0).GetDatabase(),
|
||||
1)
|
||||
1,
|
||||
mt.Table.FriendDb.GetById(0).GetMaxOpenConns(),
|
||||
mt.Table.FriendDb.GetById(0).GetMaxIdleConns())
|
||||
}
|
||||
|
||||
func (this *app) GetHttpListenPort() int32 {
|
||||
|
@ -28,6 +28,8 @@ type GameDb struct {
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
max_open_conns int32
|
||||
max_idle_conns int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
@ -39,6 +41,8 @@ type FriendDb struct {
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
max_open_conns int32
|
||||
max_idle_conns int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
@ -139,6 +143,22 @@ func (this *GameDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetMaxOpenConns() int32 {
|
||||
return this.max_open_conns
|
||||
}
|
||||
|
||||
func (this *GameDb) HasMaxOpenConns() bool {
|
||||
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||
}
|
||||
|
||||
func (this *GameDb) GetMaxIdleConns() int32 {
|
||||
return this.max_idle_conns
|
||||
}
|
||||
|
||||
func (this *GameDb) HasMaxIdleConns() bool {
|
||||
return (this._flags1_ & (uint64(1) << 7)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
@ -179,6 +199,22 @@ func (this *FriendDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetMaxOpenConns() int32 {
|
||||
return this.max_open_conns
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasMaxOpenConns() bool {
|
||||
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||
}
|
||||
|
||||
func (this *FriendDb) GetMaxIdleConns() int32 {
|
||||
return this.max_idle_conns
|
||||
}
|
||||
|
||||
func (this *FriendDb) HasMaxIdleConns() bool {
|
||||
return (this._flags1_ & (uint64(1) << 7)) > 0
|
||||
}
|
||||
|
||||
func (this *Config) GetGameapiUrl() string {
|
||||
return this.gameapi_url
|
||||
}
|
||||
@ -206,6 +242,8 @@ func (this *GameDb) LoadFromKv(kv map[string]interface{}) {
|
||||
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 *FriendDb) LoadFromKv(kv map[string]interface{}) {
|
||||
@ -214,6 +252,8 @@ func (this *FriendDb) LoadFromKv(kv map[string]interface{}) {
|
||||
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{}) {
|
||||
|
@ -23,6 +23,8 @@ message GameDb
|
||||
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 FriendDb
|
||||
@ -32,6 +34,8 @@ message FriendDb
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user