| 123456789101112131415161718192021222324252627282930313233343536 |
- package main
- import (
- "context"
- "git.wecise.com/wecise/odb-go/odb"
- "log"
- "time"
- )
- func main() {
- log.SetFlags(log.LstdFlags | log.Lshortfile)
- client, err := odb.NewClient(&odb.Config{
- Keyspace: "matrix",
- //Hosts: []string{"127.0.0.1:11001"},
- Hosts: []string{"172.26.38.247:11001"},
- //Hosts: []string{"47.92.151.165:11001"},
-
- })
- if err != nil {
- log.Fatal(err)
- }
- start := time.Now()
- ctx, cancel := context.WithTimeout(context.Background(), time.Second*120)
- defer cancel()
- _, err = client.Query(`update /matrix/devops/alert set status = 10 where biz = 'test';
- select biz, src, id, status, ctime, vtime from /matrix/devops/alert where biz = 'test' and host = 'test' and status = 10 order by ctime limit -1;`).WithContext(ctx).Do() // mql
- if err != nil {
- log.Println(time.Now().Sub(start).Seconds())
- log.Fatal(err)
- }
- log.Println(time.Now().Sub(start).Seconds())
- //for _, d := range res.Data {
- // log.Println(d["id"])
- //}
- }
|