t.Fatal(err) } } type Page struct { Title string RevID uuid.UUID Body string Hits int Protected bool Modified time.Time Attachment []byte } var pages = []*Page{ &Page{"Frontpage", uuid.TimeUUID(), "Hello world!", 0, false, time.Date(2012, 8, 20, 10, 0, 0, 0, time.UTC), nil}, &Page{"Frontpage", uuid.TimeUUID(), "Hello modified world!", 0, false, time.Date(2012, 8, 22, 10, 0, 0, 0, time.UTC), []byte("img data\x00")}, &Page{"LoremIpsum", uuid.TimeUUID(), "Lorem ipsum dolor sit amet", 12, true, time.Date(2012, 8, 22, 10, 0, 8, 0, time.UTC), nil}, } func TestWiki(t *testing.T) { db, err := sql.Open("gocql", "localhost:9042 compression=snappy") if err != nil { t.Fatal(err) } db.Exec("DROP KEYSPACE gocql_wiki") if _, err := db.Exec(`CREATE KEYSPACE gocql_wiki WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }`); err != nil {
func NewId() (id string) { id = uuid.TimeUUID().String() return }