Git Product home page Git Product logo

beersample-go's Introduction

Couchbase Beer Tutorial

This tutorial uses Go in combination with Couchbase Server to display and manage beers and breweries found in the beer-sample dataset.

Quick Start

Install Couchbase Server: http://www.couchbase.com/download

During initial configuration load beer-sample dataset. It could be also loaded later if your node/cluster has free space. More info http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-sampledata-beer.html

Add two more views to your bucket. To save prevous design documents you should first copy your design document from "Production Views" tab to "Development Views", update it and publish back to production. Here are two new views you need:

  • Design document: _design/beer. View: by_name
function (doc, meta) {
  if(doc.type && doc.type == "beer") {
    emit(doc.name, null);
  }
}
  • Design document: _design/brewery. View: by_name
function (doc, meta) {
  if(doc.type && doc.type == "brewery") {
    emit(doc.name, null);
  }
}

Clone this repo:

$ git clone git://github.com/couchbaselabs/beersample-go.git
Cloning into 'beersample-go'...

Run the application.

$ go run
Starting server on :9980

Navigate to http://localhost:9980/welcome.

beersample-go's People

Contributors

brett19 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beersample-go's Issues

Question

NewViewQuery on example returns nil -> i've been looking at the go api for couchbase and it seems that the NewViewQuery returns a nil reference for this example beer-example
Docs from here http://developer.couchbase.com/documentation/server/current/sdks/go-beta/querying.html
I wrote a small example myself as well and still same problem.

    vq := gocb.NewViewQuery("brewery", "by_name").Limit(2)
    rows, err := bucket.ExecuteViewQuery(vq)

    if err != nil {
        fmt.Printf("Error")
    }

    var row interface{}
    for rows.Next(&row) { // rows is nil here and the loop crashes
        fmt.Printf("Got row `%+v`\n")
    }

I am running couchbase inside a docker container based on the official images and only expose the 8091 to the outside.
go version go1.6.2 darwin/amd64

Any help would be greatly appreciated.

Compile Fails at Current HEAD ( 1a64b11 )

Compile of beersample.go fails at the current HEAD of this project: 1a64b11

This occurs if either of these methods is used:

  • git clone of this project followed by 'go build'
  • normal 'go get' of the project
Error messages are:./beersample.go:110: multiple-value bucket.ExecuteViewQuery() in single-value context
./beersample.go:141: multiple-value bucket.ExecuteViewQuery() in single-value context
./beersample.go:258: multiple-value bucket.ExecuteViewQuery() in single-value context
./beersample.go:280: multiple-value bucket.ExecuteViewQuery() in single-value context

The package imported package github.com/couchbaselabs/gocb is at couchbase/gocb@3d0e906 .

The cause appears to be the gocb change at couchbase/gocb@1bb4fb7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.