1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-07-04 05:13:26 +00:00
Files
MiraiGo/client/internal/network/rpc.go
wdvxdr 435d2fd85f refactor: 手动指定decode函数
(cherry picked from commit 13d6711f27)
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)
}