Skip to content

Commit

Permalink
check in a spam generator
Browse files Browse the repository at this point in the history
  • Loading branch information
tobert committed Oct 29, 2013
1 parent 6116c07 commit fdf8d30
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions spam/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"fmt"
"log"
"time"
"tux21b.org/v1/gocql"
"tux21b.org/v1/gocql/uuid"
)

func main() {
cluster := gocql.NewCluster("127.0.0.1")
cluster.Keyspace = "skeezy"
cluster.Consistency = gocql.Quorum

cass, err := cluster.CreateSession()
if err != nil {
panic(fmt.Sprintf("Error creating Cassandra session: %v", err))
}
defer cass.Close()

authors := []string{"spammer", "program"}
body := "blah blah blah keyword blah"
created := time.Now()
tags := []string{"spam", "test", "keywords"}

for i := 0; i < 10000; i++ {
id := uuid.TimeUUID()
fmt.Printf("id: %s\n", id)
err = cass.Query(`INSERT INTO posts (id, authors, body, dttm, tags) VALUES (?, ?, ?, ?, ?)`, id, authors, body, created, tags).Exec()
if err != nil {
log.Fatal(err)
}
}
}

0 comments on commit fdf8d30

Please sign in to comment.