-
-
Save titanous/edafe5383c81c22aed5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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