Skip to content

Parsing Call function of client #80

Closed
@DylanVerstraete

Description

@DylanVerstraete

I'm having issues parsing the result of the Call function of this client.

In the Tarantool console i'm getting this response from a simple select:

unix/:/var/run/tarantool/tarantool.sock> select * from info
---
- metadata:
  - name: CONSENSUSCHANGEID
    type: string
  - name: HEIGHT
    type: integer
  rows:
  - ['initial', 0]

While in the client after creating a function with Lua, so I can later reuse this logic.
I'm getting this as response from the client.Call function.

res.Data
<[]interface {}> (length: 1, cap: 1)
[0]:<interface {}>
data:<[]interface {}> (length: 1, cap: 1)
[0]:<interface {}>
data:<map[interface {}]interface {}> (length: 2)
<interface {}>:<interface {}>
data:<[]interface {}> (length: 2, cap: 2)
[0]:<interface {}>
data:<map[interface {}]interface {}> (length: 2)
<interface {}>:<interface {}>
data:"CONSENSUSCHANGEID"
[1]:<interface {}>
data:<map[interface {}]interface {}> (length: 2)
<interface {}>:<interface {}>
data:"HEIGHT"

It's giving me an array of interfaces of array of interfaces and so on.. to eventually find only the metadata column names in there. Row data is not present.

After printing them with fmt.Print its giving me following correct output:
[[map[metadata:[map[name:CONSENSUSCHANGEID type:string] map[name:HEIGHT type:integer]] rows:[[initial 0]]]]]

So this means the data of the rows is somewhere in there and magically parsed by fmt.Print. Can someone please elaborate how one could parse this into a useable data form?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions