go grammes - 如何从 gremlin 获取 属性,而不仅仅是 go grammes 的值

go grammes - how to get property from gremlin, not just the value with go grammes

你好我正在使用 golang 包“github.com/northwesternmutual/grammes”并且想要获取字段而不仅仅是来自响应客户端的值所以我可以将它解码为 json

data, err := client.ExecuteQuery(g.V().Has("person", "name", "aksan").Values())
if err != nil {
    log.Fatalf("Querying error: %s", err.Error())
}
var responseStruct map[string]interface{}
err = json.Unmarshal(data[0], &responseStruct)
if err != nil {
    log.Fatalf("unmarshal error: %s", err.Error())
}
// Log out the response.
PrettyPrint(responseStruct["@value"], "result")

响应是

[
   {
      "@type": "g:Int64",
      "@value": 6
   },
   "p01",
   {
      "@type": "g:Int64",
      "@value": 10
   },
   "aksan",
   {
      "@type": "g:Int32",
      "@value": 29
   }
]

我想要的是结果会显示字段喜欢@fields 或类似这样的东西

[
   "height":{
      "@type": "g:Int64",
      "@value": 6
   },
   "code":"p01",
   "weight":{
      "@type": "g:Int64",
      "@value": 10
   },
   "name":"aksan",
   "age":{
      "@type": "g:Int32",
      "@value": 29
   }
]

使用ValueMap()代替Values()