Documentation ¶
Index ¶
- Constants
- Variables
- func GetGameList(db dbm.KV, values []string) []*gt.Game
- func GetName() string
- func Init(name string, sub []byte)
- func Key(id string) (key []byte)
- func List(db dbm.Lister, stateDB dbm.KV, param *gt.QueryGameListByStatusAndAddr) (types.Message, error)
- func QueryCountByStatusAndAddr(stateDB dbm.KV, status int32, addr string) int64
- func QueryGameListByIds(db dbm.KV, infos *gt.QueryGameInfos) (types.Message, error)
- func QueryGameListByPage(db dbm.Lister, stateDB dbm.KV, param *gt.QueryGameListByStatusAndAddr) (types.Message, error)
- func QueryGameListCount(stateDB dbm.KV, param *gt.QueryGameListCount) (types.Message, error)
- type Action
- func (action *Action) GameCancel(cancel *gt.GameCancel) (*types.Receipt, error)
- func (action *Action) GameClose(close *gt.GameClose) (*types.Receipt, error)
- func (action *Action) GameCreate(create *gt.GameCreate) (*types.Receipt, error)
- func (action *Action) GameMatch(match *gt.GameMatch) (*types.Receipt, error)
- func (action *Action) GetIndex(game *gt.Game) int64
- func (action *Action) GetKVSet(game *gt.Game) (kvset []*types.KeyValue)
- func (action *Action) GetReceiptLog(game *gt.Game) *types.ReceiptLog
- type Game
- func (g *Game) CheckReceiptExecOk() bool
- func (g *Game) ExecDelLocal_Cancel(payload *gt.GameCancel, tx *types.Transaction, receiptData *types.ReceiptData, ...) (*types.LocalDBSet, error)
- func (g *Game) ExecDelLocal_Close(payload *gt.GameClose, tx *types.Transaction, receiptData *types.ReceiptData, ...) (*types.LocalDBSet, error)
- func (g *Game) ExecDelLocal_Create(payload *gt.GameCreate, tx *types.Transaction, receiptData *types.ReceiptData, ...) (*types.LocalDBSet, error)
- func (g *Game) ExecDelLocal_Match(payload *gt.GameMatch, tx *types.Transaction, receiptData *types.ReceiptData, ...) (*types.LocalDBSet, error)
- func (g *Game) ExecLocal_Cancel(payload *gt.GameCancel, tx *types.Transaction, receiptData *types.ReceiptData, ...) (*types.LocalDBSet, error)
- func (g *Game) ExecLocal_Close(payload *gt.GameClose, tx *types.Transaction, receiptData *types.ReceiptData, ...) (*types.LocalDBSet, error)
- func (g *Game) ExecLocal_Create(payload *gt.GameCreate, tx *types.Transaction, receiptData *types.ReceiptData, ...) (*types.LocalDBSet, error)
- func (g *Game) ExecLocal_Match(payload *gt.GameMatch, tx *types.Transaction, receiptData *types.ReceiptData, ...) (*types.LocalDBSet, error)
- func (g *Game) Exec_Cancel(payload *gt.GameCancel, tx *types.Transaction, index int) (*types.Receipt, error)
- func (g *Game) Exec_Close(payload *gt.GameClose, tx *types.Transaction, index int) (*types.Receipt, error)
- func (g *Game) Exec_Create(payload *gt.GameCreate, tx *types.Transaction, index int) (*types.Receipt, error)
- func (g *Game) Exec_Match(payload *gt.GameMatch, tx *types.Transaction, index int) (*types.Receipt, error)
- func (g *Game) GetDriverName() string
- func (g *Game) GetPayloadValue() types.Message
- func (g *Game) GetTypeMap() map[string]int32
- func (g *Game) Query_QueryGameById(in *gt.QueryGameInfo) (types.Message, error)
- func (g *Game) Query_QueryGameListByIds(in *gt.QueryGameInfos) (types.Message, error)
- func (g *Game) Query_QueryGameListByStatusAndAddr(in *gt.QueryGameListByStatusAndAddr) (types.Message, error)
- func (g *Game) Query_QueryGameListCount(in *gt.QueryGameListCount) (types.Message, error)
- type ReplyGame
- type ReplyGameList
Constants ¶
const ( // Scissor 剪刀 Scissor = int32(1) // Rock 石头 Rock = int32(2) // Paper 布 Paper = int32(3) // Unknown 未知结果 Unknown = int32(4) // IsDraw 平局 IsDraw = int32(1) // IsCreatorWin creator win IsCreatorWin = int32(2) // IsMatcherWin matcher win IsMatcherWin = int32(3) // IsTimeOut 开奖超时 IsTimeOut = int32(4) // ListDESC desc query ListDESC = int32(0) // ListASC asc query ListASC = int32(1) // GameCount 根据状态,地址统计整个合约目前总共成功执行了多少场游戏 GameCount = "GameCount" // MaxGameAmount max game amount.单位为types.Coin 1e8 MaxGameAmount = int64(100) // MinGameAmount min game amount MinGameAmount = int64(2) // DefaultCount 默认一次取多少条记录 DefaultCount = int64(20) // MaxCount 最多取100条 MaxCount = int64(100) //ActiveTime 从有matcher参与游戏开始计算本局游戏开奖的有效时间,单位为天 ActiveTime = int64(24) )
Variables ¶
var ( ConfNameActiveTime = gt.GameX + ":" + "activeTime" ConfNameDefaultCount = gt.GameX + ":" + "defaultCount" ConfNameMaxCount = gt.GameX + ":" + "maxCount" ConfNameMaxGameAmount = gt.GameX + ":" + "maxGameAmount" ConfNameMinGameAmount = gt.GameX + ":" + "minGameAmount" )
name configured in manager
Functions ¶
func GetGameList ¶
GetGameList 安全批量查询方式,防止因为脏数据导致查询接口奔溃
func List ¶
func List(db dbm.Lister, stateDB dbm.KV, param *gt.QueryGameListByStatusAndAddr) (types.Message, error)
List query game list
func QueryCountByStatusAndAddr ¶
QueryCountByStatusAndAddr query game count by status and addr
func QueryGameListByIds ¶
QueryGameListByIds query game list by gameIds
func QueryGameListByPage ¶
func QueryGameListByPage(db dbm.Lister, stateDB dbm.KV, param *gt.QueryGameListByStatusAndAddr) (types.Message, error)
QueryGameListByPage 分页查询
func QueryGameListCount ¶
QueryGameListCount count数查询
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action action struct
func NewAction ¶
func NewAction(g *Game, tx *types.Transaction, index int) *Action
NewAction new action
func (*Action) GameCancel ¶
GameCancel cancel game
func (*Action) GameCreate ¶
GameCreate create game
func (*Action) GetReceiptLog ¶
func (action *Action) GetReceiptLog(game *gt.Game) *types.ReceiptLog
GetReceiptLog get receipt log
type Game ¶
type Game struct {
drivers.DriverBase
}
Game the game inherits all the attributes of the driverBase.
func (*Game) CheckReceiptExecOk ¶
CheckReceiptExecOk return true to check if receipt ty is ok
func (*Game) ExecDelLocal_Cancel ¶
func (g *Game) ExecDelLocal_Cancel(payload *gt.GameCancel, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)
ExecDelLocal_Cancel roll back local db data for cancel
func (*Game) ExecDelLocal_Close ¶
func (g *Game) ExecDelLocal_Close(payload *gt.GameClose, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)
ExecDelLocal_Close roll back local db data for close
func (*Game) ExecDelLocal_Create ¶
func (g *Game) ExecDelLocal_Create(payload *gt.GameCreate, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)
ExecDelLocal_Create roll back local db data for create
func (*Game) ExecDelLocal_Match ¶
func (g *Game) ExecDelLocal_Match(payload *gt.GameMatch, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)
ExecDelLocal_Match roll back local db data for match
func (*Game) ExecLocal_Cancel ¶
func (g *Game) ExecLocal_Cancel(payload *gt.GameCancel, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)
ExecLocal_Cancel save receiptData for cancel
func (*Game) ExecLocal_Close ¶
func (g *Game) ExecLocal_Close(payload *gt.GameClose, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)
ExecLocal_Close save receiptData for close
func (*Game) ExecLocal_Create ¶
func (g *Game) ExecLocal_Create(payload *gt.GameCreate, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)
ExecLocal_Create save receiptData for create
func (*Game) ExecLocal_Match ¶
func (g *Game) ExecLocal_Match(payload *gt.GameMatch, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)
ExecLocal_Match save receiptData for Match
func (*Game) Exec_Cancel ¶
func (g *Game) Exec_Cancel(payload *gt.GameCancel, tx *types.Transaction, index int) (*types.Receipt, error)
Exec_Cancel Cancel game
func (*Game) Exec_Close ¶
func (g *Game) Exec_Close(payload *gt.GameClose, tx *types.Transaction, index int) (*types.Receipt, error)
Exec_Close Close game
func (*Game) Exec_Create ¶
func (g *Game) Exec_Create(payload *gt.GameCreate, tx *types.Transaction, index int) (*types.Receipt, error)
Exec_Create Create game
func (*Game) Exec_Match ¶
func (g *Game) Exec_Match(payload *gt.GameMatch, tx *types.Transaction, index int) (*types.Receipt, error)
Exec_Match Match game
func (*Game) GetPayloadValue ¶
GetPayloadValue get payload value
func (*Game) Query_QueryGameById ¶
Query_QueryGameById query game by gameID
func (*Game) Query_QueryGameListByIds ¶
Query_QueryGameListByIds query game list by gameIDs
func (*Game) Query_QueryGameListByStatusAndAddr ¶
func (g *Game) Query_QueryGameListByStatusAndAddr(in *gt.QueryGameListByStatusAndAddr) (types.Message, error)
Query_QueryGameListByStatusAndAddr query game list by status and addr
func (*Game) Query_QueryGameListCount ¶
Query_QueryGameListCount query game count by status and addr
type ReplyGame ¶
type ReplyGame struct {
Game *Game `json:"game"`
}
ReplyGame the data structure returned when querying a single game.
type ReplyGameList ¶
type ReplyGameList struct {
Games []*Game `json:"games"`
}
ReplyGameList the data structure returned when querying the game list.