func (cli *TMSPClient) QuerySync(query []byte) (code types.CodeType, result []byte, log string, err error) { reqres := cli.queueRequest(types.RequestQuery(query)) cli.FlushSync() if cli.err != nil { return types.CodeType_InternalError, nil, "", cli.err } res := reqres.Response return res.Code, res.Data, res.Log, nil }
// Query application state func cmdQuery(c *cli.Context) { args := c.Args() if len(args) != 1 { fmt.Println("query takes 1 argument") return } queryString := args[0] query := []byte(queryString) if len(queryString) > 2 && strings.HasPrefix(queryString, "0x") { var err error query, err = hex.DecodeString(queryString[2:]) if err != nil { fmt.Println(err.Error()) return } } res, err := makeRequest(conn, types.RequestQuery(query)) if err != nil { fmt.Println(err.Error()) return } printResponse(res, string(res.Data)) }
func (cli *TMSPClient) QueryAsync(query []byte) *ReqRes { return cli.queueRequest(types.RequestQuery(query)) }