valid.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. Before you execute the program, Launch `cqlsh` and execute:
  3. create keyspace example with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
  4. create table example.tweet(timeline text, id UUID, text text, PRIMARY KEY(id));
  5. create index on example.tweet(timeline);
  6. */
  7. package main
  8. // CGO_ENABLED=1 go run --ldflags '-linkmode external -extldflags "-static"' valid.go
  9. // #cgo LDFLAGS: -L/opt/odbserver/sqlite -lsqlite -ldl
  10. // #include "/opt/odbserver/sqlite/sqlite.h"
  11. // #include <stdint.h>
  12. // #include <stdlib.h>
  13. // extern int64_t uhaha_seed;
  14. // extern int64_t uhaha_ts;
  15. // void uhaha_begin_reader();
  16. // void uhaha_end_reader();
  17. import (
  18. "flag"
  19. . "git.wecise.com/wecise/odbserver/odb"
  20. "git.wecise.com/wecise/odbserver/odb/test"
  21. "gitee.com/wecisecode/util/logger"
  22. )
  23. func main() {
  24. // connect to the cluster
  25. //cluster := gocql.NewCluster("192.168.40.14")
  26. keyspace := flag.String("keyspace", "matrix", "keyspace")
  27. flag.Parse()
  28. option := &Option{Cache: CacheAll, Keyspace: *keyspace, DisableInitialHostLookup: true, DisableTask: true, DisableNotify: true}
  29. g, err := test.NewG(option)
  30. if err != nil {
  31. logger.Error(err.Error())
  32. } else {
  33. defer g.Close()
  34. }
  35. //logger.SetRollingDaily("C:/test/zkcron/src/test", "test.log")
  36. logger.SetConsole(true)
  37. print(g.Schema_Valid())
  38. }