Skip to content

dinedal/golang-driver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golang-driver

Golang wrapper of the DataStax/Cassandra C/C++ driver

Basic support for prepared statements and ad hoc queries. Lacking support for collections, but that will be remedied shortly.

Build

  1. Build and install the DataStax C/C++ driver
  2. Install go get github.com/mstump/golang-driver/cassandra
  3. Run the example go run $GOPATH/src/github.com/mstump/golang-driver/examples/basic.go

Example Usage

package main

import (
	"cassandra"
	"fmt"
)

func main() {
	cluster := cassandra.NewCassCluster()
	cluster.SetContactPoints("127.0.0.1")

	sessionFuture := cluster.Connect()
	sessionFuture.Wait()
	session := sessionFuture.Session()

	statement := cassandra.NewCassStatement("select cluster_name from system.local;", 0)
	future := session.Execute(statement)
	future.Wait()

	result := future.Result()

	fmt.Printf("Clusters:\r\n")
	for result.Next() {
		var clusterName string
		result.Scan(&clusterName)
		fmt.Printf("%s\n", clusterName)
	}

	fmt.Printf("DONE.\r\n")
}

About

Golang wrapper of the DataStax/Cassandra C++ driver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%