Skip to content

Instantly share code, notes, and snippets.

@ingenthr
Last active September 16, 2015 13:14
Show Gist options
  • Save ingenthr/701e903d50a2338a68f9 to your computer and use it in GitHub Desktop.
Save ingenthr/701e903d50a2338a68f9 to your computer and use it in GitHub Desktop.
N1QL Query from Go
cluster, _ := gocb.Connect("couchbase://localhost")
bucket, _ := cluster.OpenBucket("default", "")
query := gocb.NewN1qlQuery("SELECT * FROM default")
rows := bucket.ExecuteViewQuery(query)
var row interface{}
for rows.Next(&row) {
fmt.Printf("Row: %+v\n", row)
}
rows.Close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment