Description
1. Return results and metadata similar to existing cbq output :
go_n1ql needs to also return the signature, and the result stats to maintain backward compatibility with the output of the previous cbq shell. Right now it only returns the results array.
2. The Exec vs the Query method for DML statements. n1ql.Exec gives you mutation count but does not work if a returning clause exists. n1ql.Query does not give mutation count. These 2 need to be unified.
3. For the n1ql.Query method, it is important to know the projection list before hand otherwise we cannot return multiple attributes (columns). This is hard unless the input n1ql query statement is parsed. This should be handled by the API.
The cases : Select * … Vs select a,b,c —>
The rows.Scan method that gets the returned rows (documents) will need to contain the following for the 2 cases
rows.Scan(&results)
VS rows.Scan(&a,
&b, &c) (where a,b,c are strings or in my case json.Rawmessage )
Preprocess n1ql queries to see what is contained in the projection list and then display appropriately.
4. For named and positional parameters to be handled, we need to use the Prepare method, but since the n1ql statement doesn't start with a Prepare (its a generic select with $pos or $name) we need to parse the statement or find an intelligent way to know when we need to pass in the named parameters and query para -args (for positional parameters).
It might be better to handle all the different cases for Query Exec and Prepare in the API