takin' care of business
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
mock
.gitignore
.travis.yml
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
_overview.go
configurable.go
configurable_test.go
docker-compose.yml
interfaces.go
loggerable.go
loggerable_test.go
operatable.go
operatable_test.go
wait-for-it.sh

README.md

tcb

Build Status Coverage Status GoDoc

takin' care of business

1rqml0

what is this ?

this is an adapter library for couchbase client gocb i made gocbadapter for that before, i want refactor and refine by recreating.

How to Use

Install

it's just same as traditional style go get github.com/deadcheat/tcb

Example

package main

import (
	"fmt"

	"github.com/deadcheat/tcb"
)

type Data struct {
	Text string
}

func main() {
	config := tcb.Configure{
		ConnectString: "couchbase://localhost",
		BucketConfigs: []tcb.BucketConfig{
			tcb.BucketConfig{
				Name:     "default",
				Password: "",
			},
		},
		User:     "Administrator",
		Password: "password",
	}
	c := tcb.NewCluster(config)
	if err := c.Open(); err != nil {
		panic(err)
	}
	defer c.CloseAll()
	o, _ := c.Operator("default")
	data := Data{
		Text: "TestData",
	}
	if _, err := o.Insert("key", &data, 0); err != nil {
		panic(err)
	}
	var m Data
	if _, err := o.Get("key", &m); err != nil {
		panic(err)
	}
	fmt.Println("data : ", m)
	if _, err := o.Remove("key"); err != nil {
		panic(err)
	}
}