This commit is contained in:
meixiongfeng 2023-09-13 17:41:37 +08:00
commit 6f894c14d5
11 changed files with 205 additions and 5 deletions

View File

@ -8,7 +8,7 @@ import (
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
) )
func NewSys(RedisUrl []string, RedisPassword string, poolSize int, timeOut time.Duration, func NewSys(RedisUrl []string, RedisPassword string, poolSize, minConns int, timeOut time.Duration,
codec core.ICodec, codec core.ICodec,
) (sys *Redis, err error) { ) (sys *Redis, err error) {
var ( var (
@ -18,6 +18,7 @@ func NewSys(RedisUrl []string, RedisPassword string, poolSize int, timeOut time.
Addrs: RedisUrl, Addrs: RedisUrl,
Password: RedisPassword, Password: RedisPassword,
PoolSize: poolSize, PoolSize: poolSize,
MinIdleConns: minConns,
DialTimeout: timeOut, DialTimeout: timeOut,
ReadTimeout: timeOut, ReadTimeout: timeOut,
WriteTimeout: timeOut, WriteTimeout: timeOut,

View File

@ -23,6 +23,7 @@ type Options struct {
Redis_Cluster_Addr []string Redis_Cluster_Addr []string
Redis_Cluster_Password string Redis_Cluster_Password string
PoolSize int PoolSize int
MinConns int
TimeOut time.Duration TimeOut time.Duration
Codec core.ICodec Codec core.ICodec
} }
@ -82,7 +83,8 @@ func newOptions(config map[string]interface{}, opts ...Option) Options {
Redis_Single_DB: 1, Redis_Single_DB: 1,
Redis_Cluster_Addr: []string{"127.0.0.1:6379"}, Redis_Cluster_Addr: []string{"127.0.0.1:6379"},
Redis_Cluster_Password: "", Redis_Cluster_Password: "",
PoolSize: 200, PoolSize: 64,
MinConns: 32,
TimeOut: time.Second * 3, TimeOut: time.Second * 3,
} }
if config != nil { if config != nil {
@ -101,7 +103,8 @@ func newOptionsByOption(opts ...Option) Options {
Redis_Single_DB: 1, Redis_Single_DB: 1,
Redis_Cluster_Addr: []string{"127.0.0.1:6379"}, Redis_Cluster_Addr: []string{"127.0.0.1:6379"},
Redis_Cluster_Password: "", Redis_Cluster_Password: "",
PoolSize: 200, PoolSize: 64,
MinConns: 32,
TimeOut: time.Second * 3, TimeOut: time.Second * 3,
} }
for _, o := range opts { for _, o := range opts {

View File

@ -31,6 +31,7 @@ func (this *Redis) init() (err error) {
this.options.Redis_Single_Password, this.options.Redis_Single_Password,
this.options.Redis_Single_DB, this.options.Redis_Single_DB,
this.options.PoolSize, this.options.PoolSize,
this.options.MinConns,
this.options.TimeOut, this.options.TimeOut,
this, this,
) )
@ -39,6 +40,7 @@ func (this *Redis) init() (err error) {
this.options.Redis_Cluster_Addr, this.options.Redis_Cluster_Addr,
this.options.Redis_Cluster_Password, this.options.Redis_Cluster_Password,
this.options.PoolSize, this.options.PoolSize,
this.options.MinConns,
this.options.TimeOut, this.options.TimeOut,
this, this,
) )

View File

@ -8,7 +8,7 @@ import (
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
) )
func NewSys(RedisUrl, RedisPassword string, RedisDB int, poolSize int, timeOut time.Duration, func NewSys(RedisUrl, RedisPassword string, RedisDB int, poolSize, minConns int, timeOut time.Duration,
codec core.ICodec, codec core.ICodec,
) (sys *Redis, err error) { ) (sys *Redis, err error) {
var ( var (
@ -19,6 +19,7 @@ func NewSys(RedisUrl, RedisPassword string, RedisDB int, poolSize int, timeOut t
Password: RedisPassword, Password: RedisPassword,
DB: RedisDB, DB: RedisDB,
PoolSize: poolSize, PoolSize: poolSize,
MinIdleConns: minConns,
DialTimeout: timeOut, DialTimeout: timeOut,
WriteTimeout: timeOut, WriteTimeout: timeOut,
ReadTimeout: timeOut, ReadTimeout: timeOut,

View File

@ -68,7 +68,7 @@ func (this *configureComp) LoadDragonPlay() {
this.play = make(map[string]*cfg.GameDragonPlayData) this.play = make(map[string]*cfg.GameDragonPlayData)
if _configure, ok := v.(*cfg.GameDragonPlay); ok { if _configure, ok := v.(*cfg.GameDragonPlay); ok {
for _, v := range _configure.GetDataList() { for _, v := range _configure.GetDataList() {
this.play[v.Id+"-"+strconv.Itoa(int(v.Grow))+"-"+strconv.Itoa(int(v.Type))] = v this.play[v.Id+"-"+strconv.Itoa(int(v.Type))+"-"+strconv.Itoa(int(v.Interact))] = v
} }
return return
} }

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameGameId struct {
_dataMap map[int32]*GameGameIdData
_dataList []*GameGameIdData
}
func NewGameGameId(_buf []map[string]interface{}) (*GameGameId, error) {
_dataList := make([]*GameGameIdData, 0, len(_buf))
dataMap := make(map[int32]*GameGameIdData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameGameIdData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameGameId{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameGameId) GetDataMap() map[int32]*GameGameIdData {
return table._dataMap
}
func (table *GameGameId) GetDataList() []*GameGameIdData {
return table._dataList
}
func (table *GameGameId) Get(key int32) *GameGameIdData {
return table._dataMap[key]
}

View File

@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameGameIdData struct {
Id int32
Type int32
}
const TypeId_GameGameIdData = 1662075251
func (*GameGameIdData) GetTypeId() int32 {
return 1662075251
}
func (_v *GameGameIdData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
return
}
func DeserializeGameGameIdData(_buf map[string]interface{}) (*GameGameIdData, error) {
v := &GameGameIdData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameGameKlotski struct {
_dataMap map[int32]*GameGameKlotskiData
_dataList []*GameGameKlotskiData
}
func NewGameGameKlotski(_buf []map[string]interface{}) (*GameGameKlotski, error) {
_dataList := make([]*GameGameKlotskiData, 0, len(_buf))
dataMap := make(map[int32]*GameGameKlotskiData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameGameKlotskiData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameGameKlotski{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameGameKlotski) GetDataMap() map[int32]*GameGameKlotskiData {
return table._dataMap
}
func (table *GameGameKlotski) GetDataList() []*GameGameKlotskiData {
return table._dataList
}
func (table *GameGameKlotski) Get(key int32) *GameGameKlotskiData {
return table._dataMap[key]
}

View File

@ -0,0 +1,56 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameGameKlotskiData struct {
Id int32
Chequer *Gamekv
Start int32
Blockstype []*Gamekv
Finish int32
}
const TypeId_GameGameKlotskiData = -634857145
func (*GameGameKlotskiData) GetTypeId() int32 {
return -634857145
}
func (_v *GameGameKlotskiData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["chequer"].(map[string]interface{}); !_ok_ { err = errors.New("chequer error"); return }; if _v.Chequer, err = DeserializeGamekv(_x_); err != nil { return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["start"].(float64); !_ok_ { err = errors.New("start error"); return }; _v.Start = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["blockstype"].([]interface{}); !_ok_ { err = errors.New("blockstype error"); return }
_v.Blockstype = make([]*Gamekv, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gamekv
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGamekv(_x_); err != nil { return } }
_v.Blockstype = append(_v.Blockstype, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["finish"].(float64); !_ok_ { err = errors.New("finish error"); return }; _v.Finish = int32(_tempNum_) }
return
}
func DeserializeGameGameKlotskiData(_buf map[string]interface{}) (*GameGameKlotskiData, error) {
v := &GameGameKlotskiData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -17,6 +17,7 @@ type GameMainStageData struct {
PreviousGroupId []int32 PreviousGroupId []int32
Previoustage int32 Previoustage int32
Episodetype int32 Episodetype int32
StageParam int32
Venturemodelspeed float32 Venturemodelspeed float32
Venturemodelscale float32 Venturemodelscale float32
MoveType int32 MoveType int32
@ -85,6 +86,7 @@ func (_v *GameMainStageData)Deserialize(_buf map[string]interface{}) (err error)
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["previoustage"].(float64); !_ok_ { err = errors.New("previoustage error"); return }; _v.Previoustage = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["previoustage"].(float64); !_ok_ { err = errors.New("previoustage error"); return }; _v.Previoustage = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Episodetype"].(float64); !_ok_ { err = errors.New("Episodetype error"); return }; _v.Episodetype = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Episodetype"].(float64); !_ok_ { err = errors.New("Episodetype error"); return }; _v.Episodetype = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["stage_param"].(float64); !_ok_ { err = errors.New("stage_param error"); return }; _v.StageParam = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["venturemodelspeed"].(float64); !_ok_ { err = errors.New("venturemodelspeed error"); return }; _v.Venturemodelspeed = float32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["venturemodelspeed"].(float64); !_ok_ { err = errors.New("venturemodelspeed error"); return }; _v.Venturemodelspeed = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["venturemodelscale"].(float64); !_ok_ { err = errors.New("venturemodelscale error"); return }; _v.Venturemodelscale = float32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["venturemodelscale"].(float64); !_ok_ { err = errors.New("venturemodelscale error"); return }; _v.Venturemodelscale = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["move_type"].(float64); !_ok_ { err = errors.New("move_type error"); return }; _v.MoveType = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["move_type"].(float64); !_ok_ { err = errors.New("move_type error"); return }; _v.MoveType = int32(_tempNum_) }

View File

@ -258,6 +258,8 @@ type Tables struct {
Qualifying *GameQualifying Qualifying *GameQualifying
DragonPlay *GameDragonPlay DragonPlay *GameDragonPlay
DragonPlot *GameDragonPlot DragonPlot *GameDragonPlot
GameId *GameGameId
GameKlotski *GameGameKlotski
} }
func NewTables(loader JsonLoader) (*Tables, error) { func NewTables(loader JsonLoader) (*Tables, error) {
@ -1747,5 +1749,17 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.DragonPlot, err = NewGameDragonPlot(buf) ; err != nil { if tables.DragonPlot, err = NewGameDragonPlot(buf) ; err != nil {
return nil, err return nil, err
} }
if buf, err = loader("game_gameid") ; err != nil {
return nil, err
}
if tables.GameId, err = NewGameGameId(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_gameklotski") ; err != nil {
return nil, err
}
if tables.GameKlotski, err = NewGameGameKlotski(buf) ; err != nil {
return nil, err
}
return tables, nil return tables, nil
} }