Name: golang-driver
Owner: Crowdstrike
Description: Golang wrapper of the DataStax/Cassandra C++ driver
Forked from: mstump/golang-driver
Created: 2015-08-31 18:19:35.0
Updated: 2016-07-07 16:02:58.0
Pushed: 2015-08-31 18:24:11.0
Homepage: null
Size: 98
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Golang wrapper of the DataStax/Cassandra C/C++ driver 2.1 api
Basic support for prepared statements and ad hoc queries. Lacking support for collections, but that will be remedied shortly.
go get github.com/mstump/golang-driver/cassandra
go run $GOPATH/src/github.com/mstump/golang-driver/examples/basic.go
age main
rt (
"fmt"
"golang-driver/cassandra"
main() {
cluster := cassandra.NewCluster()
cluster.SetContactPoints("cassandra")
defer cluster.Finalize()
session := cassandra.NewSession()
defer session.Finalize()
sessfuture := cluster.SessionConnect(session)
sessfuture.Wait()
defer sessfuture.Finalize()
statement := cassandra.NewStatement("select cluster_name from system.local;", 0)
defer statement.Finalize()
stmtfuture := session.Execute(statement)
stmtfuture.Wait()
defer stmtfuture.Finalize()
result := stmtfuture.Result()
defer result.Finalize()
fmt.Printf("Clusters:\r\n")
for result.Next() {
var clusterName string
result.Scan(&clusterName)
fmt.Printf("%s\n", clusterName)
}
fmt.Printf("DONE.\r\n")