示例#1
0
// Helper function to open a Couchbase connection and return a specific bucket.
func ConnectToBucket(couchbaseURL, poolName, bucketName string) (bucket base.Bucket, err error) {
	bucket, err = base.GetBucket(couchbaseURL, poolName, bucketName)
	if err != nil {
		return
	}
	base.Log("Connected to <%s>, pool %s, bucket %s", couchbaseURL, poolName, bucketName)
	err = installViews(bucket)
	return
}
示例#2
0
// Helper function to open a Couchbase connection and return a specific bucket.
func ConnectToBucket(couchbaseURL, poolName, bucketName string) (bucket base.Bucket, err error) {
	bucket, err = base.GetBucket(couchbaseURL, poolName, bucketName)
	if err != nil {
		err = &base.HTTPError{http.StatusBadGateway,
			fmt.Sprintf("Unable to connect to server: %s", err)}
	} else {
		err = installViews(bucket)
	}
	return
}
示例#3
0
// Helper function to open a Couchbase connection and return a specific bucket.
func ConnectToBucket(spec base.BucketSpec) (bucket base.Bucket, err error) {
	bucket, err = base.GetBucket(spec)
	if err != nil {
		err = &base.HTTPError{http.StatusBadGateway,
			fmt.Sprintf("Unable to connect to server: %s", err)}
	} else {
		err = installViews(bucket)
	}
	return
}
示例#4
0
func init() {
	var err error
	gTestBucket, err = base.GetBucket(kTestURL, "default", "sync_gateway_tests")
	if err != nil {
		log.Fatalf("Couldn't connect to bucket: %v", err)
	}
	if err != nil {
		log.Fatalf("Couldn't install design doc: %v", err)
	}
}
示例#5
0
func init() {
	var err error
	gTestBucket, err = base.GetBucket(base.BucketSpec{
		Server:     kTestURL,
		BucketName: "sync_gateway_tests"})
	if err != nil {
		log.Fatalf("Couldn't connect to bucket: %v", err)
	}
	if err != nil {
		log.Fatalf("Couldn't install design doc: %v", err)
	}
}