Skip to content

Commit

Permalink
Correct issue where N1QL queries return a ViewResults object.
Browse files Browse the repository at this point in the history
Change-Id: I5f1613b5e650d43bf6ce03da3be126361adcb62e
Reviewed-on: http://review.couchbase.org/63119
Reviewed-by: Mark Nunberg <mark.nunberg@couchbase.com>
Tested-by: Brett Lawson <brett19@gmail.com>
  • Loading branch information
brett19 committed Apr 20, 2016
1 parent f0169a3 commit 9ec8767
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bucket_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (b *Bucket) ExecuteSpatialQuery(q *SpatialQuery) (ViewResults, error) {
return b.executeViewQuery("_spatial", q.ddoc, q.name, q.options)
}

// Performs a spatial query and returns a list of rows or an error.
func (b *Bucket) ExecuteN1qlQuery(q *N1qlQuery, params interface{}) (ViewResults, error) {
// Performs a n1ql query and returns a list of rows or an error.
func (b *Bucket) ExecuteN1qlQuery(q *N1qlQuery, params interface{}) (QueryResults, error) {
return b.cluster.doN1qlQuery(b, q, params)
}
6 changes: 3 additions & 3 deletions cluster_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (r *n1qlResults) One(valuePtr interface{}) error {
// This function assumes that `opts` already contains all the required
// settings. This function will inject any additional connection or request-level
// settings into the `opts` map (currently this is only the timeout).
func (c *Cluster) executeN1qlQuery(n1qlEp string, opts map[string]interface{}, creds []userPassPair, timeout time.Duration, client *http.Client) (ViewResults, error) {
func (c *Cluster) executeN1qlQuery(n1qlEp string, opts map[string]interface{}, creds []userPassPair, timeout time.Duration, client *http.Client) (QueryResults, error) {
reqUri := fmt.Sprintf("%s/query/service", n1qlEp)

tmostr, castok := opts["timeout"].(string)
Expand Down Expand Up @@ -199,7 +199,7 @@ type n1qlPrepData struct {
}

// Performs a spatial query and returns a list of rows or an error.
func (c *Cluster) doN1qlQuery(b *Bucket, q *N1qlQuery, params interface{}) (ViewResults, error) {
func (c *Cluster) doN1qlQuery(b *Bucket, q *N1qlQuery, params interface{}) (QueryResults, error) {
var err error
var n1qlEp string
var timeout time.Duration
Expand Down Expand Up @@ -323,6 +323,6 @@ func (c *Cluster) doN1qlQuery(b *Bucket, q *N1qlQuery, params interface{}) (View
}

// Performs a spatial query and returns a list of rows or an error.
func (c *Cluster) ExecuteN1qlQuery(q *N1qlQuery, params interface{}) (ViewResults, error) {
func (c *Cluster) ExecuteN1qlQuery(q *N1qlQuery, params interface{}) (QueryResults, error) {
return c.doN1qlQuery(nil, q, params)
}

0 comments on commit 9ec8767

Please sign in to comment.