1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00
wdvxdr 435d2fd85f
refactor: 手动指定decode函数
(cherry picked from commit 13d6711f27a100a6098c478f05d3ae8a32117d94)
2021-12-27 15:36:44 +08:00

36 lines
515 B
Go

package network
// Call is a client-side RPC call.
// refer to `net/rpc`
type Call struct {
Request *Request
Response *Response
Err error
Params RequestParams
Done chan *Call
}
type RequestParams map[string]interface{}
func (p RequestParams) Bool(k string) bool {
if p == nil {
return false
}
i, ok := p[k]
if !ok {
return false
}
return i.(bool)
}
func (p RequestParams) Int32(k string) int32 {
if p == nil {
return 0
}
i, ok := p[k]
if !ok {
return 0
}
return i.(int32)
}