Skip to content

Instantly share code, notes, and snippets.

@titanous
Created December 5, 2012 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save titanous/edafe5383c81c22aed5a to your computer and use it in GitHub Desktop.
Save titanous/edafe5383c81c22aed5a to your computer and use it in GitHub Desktop.
package main
import (
"github.com/titanous/go-backports/database/sql"
_ "github.com/titanous/gocql"
)
/*
cqlsh> CREATE KEYSPACE test WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
cqlsh> USE test;
cqlsh:test> CREATE TABLE tests (id bigint PRIMARY KEY, content text);
*/
func main() {
cassandra, err := sql.Open("gocql", "127.0.0.1:9042 keyspace=test")
if err != nil {
panic(err)
}
_, err = cassandra.Exec("INSERT INTO tests (id, content) VALUES (?, ?)", 1, "test")
if err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment