Hi,
I am running into an issue and after much research can’t seem to find the answer to it. Here is the situation: using the gocb v2 Go SDK, after running a query, I can’t access the metadata unless I iterate through the results.
Based on the documentation, it seems that I should be able to access the metadata right after running the query, without having to iterate through the results. Here is the sentence that leads me to believe that:
Once a result returns you can iterate the returned rows and/or access the QueryMetaData associated with the query.
Here is my code: queryStr := "UPSERT INTO test (KEY, VALUE) VALUES("key::1", "{"id": "1", "name":"foobar") RETURNING *"
results, err := globalCluster.Query(queryStr, &gocb.QueryOptions{ Metrics: true })
According to the documentation, once I have called the Query
function, if I don’t have any error, I should be able to access the metadata, but if I run this code: metadata, _ = results.MetaData()
, and then check the value of metadata
, I get <nil>
, whereas, if before calling metadata, _ = results.MetaData()
, I call results.One
or results.Rows
then I get a proper value for metadata
.
My question is: should I be able to access query metadata without having to iterate through the results? If yes, I will open an issue on github for it, but I wanted to double-check before doing that.
Cheers,
Bertrand.