214 lines
5.7 KiB
Go
214 lines
5.7 KiB
Go
package mtb
|
|
|
|
import (
|
|
"f5"
|
|
)
|
|
|
|
type GamesapiCluster struct {
|
|
instance_id int32
|
|
listen_port int32
|
|
http_listen_port int32
|
|
|
|
_flags1_ uint64
|
|
_flags2_ uint64
|
|
}
|
|
|
|
type Config struct {
|
|
gamesapi_url string
|
|
secret_key string
|
|
gm_open int32
|
|
gm_secret_key string
|
|
redirect_url string
|
|
max_concurrent_num int32
|
|
request_over_time int32
|
|
redirect_secret_key string
|
|
|
|
_flags1_ 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
|
|
}
|
|
|
|
func (this *GamesapiCluster) GetInstanceId() int32 {
|
|
return this.instance_id
|
|
}
|
|
|
|
func (this *GamesapiCluster) HasInstanceId() bool {
|
|
return (this._flags1_ & (uint64(1) << 1)) > 0
|
|
}
|
|
|
|
func (this *GamesapiCluster) GetListenPort() int32 {
|
|
return this.listen_port
|
|
}
|
|
|
|
func (this *GamesapiCluster) HasListenPort() bool {
|
|
return (this._flags1_ & (uint64(1) << 2)) > 0
|
|
}
|
|
|
|
func (this *GamesapiCluster) GetHttpListenPort() int32 {
|
|
return this.http_listen_port
|
|
}
|
|
|
|
func (this *GamesapiCluster) HasHttpListenPort() bool {
|
|
return (this._flags1_ & (uint64(1) << 3)) > 0
|
|
}
|
|
|
|
func (this *Config) GetGamesapiUrl() string {
|
|
return this.gamesapi_url
|
|
}
|
|
|
|
func (this *Config) HasGamesapiUrl() bool {
|
|
return (this._flags1_ & (uint64(1) << 1)) > 0
|
|
}
|
|
|
|
func (this *Config) GetSecretKey() string {
|
|
return this.secret_key
|
|
}
|
|
|
|
func (this *Config) HasSecretKey() bool {
|
|
return (this._flags1_ & (uint64(1) << 2)) > 0
|
|
}
|
|
|
|
func (this *Config) GetGmOpen() int32 {
|
|
return this.gm_open
|
|
}
|
|
|
|
func (this *Config) HasGmOpen() bool {
|
|
return (this._flags1_ & (uint64(1) << 3)) > 0
|
|
}
|
|
|
|
func (this *Config) GetGmSecretKey() string {
|
|
return this.gm_secret_key
|
|
}
|
|
|
|
func (this *Config) HasGmSecretKey() bool {
|
|
return (this._flags1_ & (uint64(1) << 4)) > 0
|
|
}
|
|
|
|
func (this *Config) GetRedirectUrl() string {
|
|
return this.redirect_url
|
|
}
|
|
|
|
func (this *Config) HasRedirectUrl() bool {
|
|
return (this._flags1_ & (uint64(1) << 5)) > 0
|
|
}
|
|
|
|
func (this *Config) GetMaxConcurrentNum() int32 {
|
|
return this.max_concurrent_num
|
|
}
|
|
|
|
func (this *Config) HasMaxConcurrentNum() bool {
|
|
return (this._flags1_ & (uint64(1) << 6)) > 0
|
|
}
|
|
|
|
func (this *Config) GetRequestOverTime() int32 {
|
|
return this.request_over_time
|
|
}
|
|
|
|
func (this *Config) HasRequestOverTime() bool {
|
|
return (this._flags1_ & (uint64(1) << 7)) > 0
|
|
}
|
|
|
|
func (this *Config) GetRedirectSecretKey() string {
|
|
return this.redirect_secret_key
|
|
}
|
|
|
|
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)
|
|
f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 2, kv)
|
|
f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv)
|
|
}
|
|
|
|
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
|
f5.ReadMetaTableField(&this.gamesapi_url, "gamesapi_url", &this._flags1_, 1, kv)
|
|
f5.ReadMetaTableField(&this.secret_key, "secret_key", &this._flags1_, 2, kv)
|
|
f5.ReadMetaTableField(&this.gm_open, "gm_open", &this._flags1_, 3, kv)
|
|
f5.ReadMetaTableField(&this.gm_secret_key, "gm_secret_key", &this._flags1_, 4, kv)
|
|
f5.ReadMetaTableField(&this.redirect_url, "redirect_url", &this._flags1_, 5, kv)
|
|
f5.ReadMetaTableField(&this.max_concurrent_num, "max_concurrent_num", &this._flags1_, 6, kv)
|
|
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)
|
|
}
|