package main import ( "fmt" "log" "strconv" "time" "git.wecise.com/wecise/common/lib/gocql/gocql" ) func main() { /* select varchar_3 from iobject where expr(iobject_lucene, '{ filter: {type: "match", field: "varchar_3", value: "3"} }') limit 100; */ cluster := gocql.NewCluster("192.168.31.201") cluster.Consistency = gocql.Quorum cluster.Keyspace = "matrix" cluster.Timeout = 100 * time.Second cluster.ProtoVersion = 4 session, err := cluster.CreateSession() if err != nil { log.Fatal(err) } defer session.Close() for k := 1058; k < 10000; k++ { fmt.Println("K======", k) for i := 0; i < 10000; i++ { sql := fmt.Sprintf("insert into iobject(id, class, varchar_%s) values( ? , ?, ?);", strconv.Itoa(i)) if err := session.Query(sql, "varchar"+strconv.Itoa(i), "/test"+strconv.Itoa(k), strconv.Itoa(i)).Exec(); err != nil { println(err) } } for i := 0; i < 5000; i++ { sql := fmt.Sprintf("insert into iobject(id, class, text_%s) values( ? , ?, ?);", strconv.Itoa(i)) if err := session.Query(sql, "test"+strconv.Itoa(i), "/test"+strconv.Itoa(k), strconv.Itoa(i)).Exec(); err != nil { println(err) } } } }