testinsert.go 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. package main
  2. import (
  3. //"fmt"
  4. //"time"
  5. //"strconv"
  6. //"math/rand"
  7. . "git.wecise.com/wecise/odbserver/odb"
  8. "git.wecise.com/wecise/odbserver/odb/test"
  9. "gitee.com/wecisecode/util/logger"
  10. )
  11. // CGO_ENABLED=1 go run --ldflags '-linkmode external -extldflags "-static"' testinsert.go
  12. // #cgo LDFLAGS: -L/opt/odbserver/sqlite -lsqlite -ldl
  13. // #include "/opt/odbserver/sqlite/sqlite.h"
  14. // #include <stdint.h>
  15. // #include <stdlib.h>
  16. // extern int64_t uhaha_seed;
  17. // extern int64_t uhaha_ts;
  18. // void uhaha_begin_reader();
  19. // void uhaha_end_reader();
  20. func main() {
  21. //options := map[string]interface{} {"cache":odb.CacheAll}
  22. //g,err:= odb.New( options )
  23. //option := &StoreOption{Cache:CacheAll}
  24. option := &Option{Cache: CacheAll, Keyspace: "ooootest", DisableInitialHostLookup: true, DisableNotify: true}
  25. g, err := test.NewG(option)
  26. if err != nil {
  27. logger.Error(err.Error())
  28. } else {
  29. defer g.Close()
  30. }
  31. //logger.SetRollingDaily("C:/test/zkcron/src/test", "test.log")
  32. logger.SetConsole(true)
  33. //logger.SetLevel(logger.DEBUG)
  34. //rst,meta,err := g.Query(`insert into /matrix/system/policy name = 'test', domain = 'cmd', innername = 'test', branch = 'test', version = '1.1', policy = {"args":"","bin":"test.sh","cron":"0/1 * * * * * *","dir":"test-1.1","rule":"/matrix/rules/test"}, tags = ["test"]`)
  35. //rst,meta,err := g.Query(`insert into /matrix/testgroup g1='g1' , g2='g2' , g3={"bank":"tag1","core":"tag2"} , v1=1 , v2=2 , f1=1.1 , f2=1.2`)
  36. //rst,meta,err := g.Query(`insert into /matrix/entity/router id="router:12345", contain=["oracle:wwwwww"]`)
  37. // SELECT contain FROM /matrix/entity/biz where id="biz:数字国网"
  38. //rst,meta,err := g.Query(`insert into /matrix/entity/biz id="biz:数字国网",name="biz:数字国网",ip="10.216.202.70",host="数字国网",company="nxgd",contain=[{"id":"app:tomcat-app1","intp":1,"floatp":3.4},{"id":"app:tomcat-app2", "strp":"strstr"},{"id":"app:tomcat-app3"]}`)
  39. //rst,meta,err := g.Query(`insert into /matrix/entity/biz id="biz:数字国网",name="biz:数字国网", ip="10.216.202.70",host="数字国网",company="nxgd",contain=[{"id":"app:tomcat-app1","intp":1,"floatp":3.4},{"id":"app:tomcat-app2", "strp":"strstr", "roles":["admin", "users"]},{"id":"app:tomcat-app3","thrd":[5,10]}]`)
  40. //rst,meta,err := g.Query(`insert into /matrix/entity/biz id="biz:数字国网",name="biz:数字国网",ip="10.216.202.70",hostname="数字国网",company="nxgd",contain=["app:tomcat-app1","app:tomcat-app2","app:tomcat-app3"]`)
  41. //rst,meta,err := g.Query(` insert into /matrix/devops/event/realtime_alert (name,severity,ctime) values ('aaa',5,'2020-03-18 12:21:12');`)
  42. /*for i:=1234567890 ; i<1234567890+10 ; i++ {
  43. rst,meta,err := g.Query( fmt.Sprintf(` insert into /matrix/testbucket4 (id, bkdata[ 'iparam1', 'iparam2', 'fparam1', 'fparam2', 'sparam1', 'vparam1']) values ('linux:wecise', [1, nil, 3.3, 6.5, '%d', 'abcdefghhhhh'] ) at '2020-07-24 10:24:16'`, i))
  44. if err != nil {
  45. logger.Info("Query error:"+err.Error())
  46. logger.Warn(meta["type"])
  47. }else{
  48. logger.Info("rst ===>", rst)
  49. //logger.Error("meta ===>", meta)
  50. if meta["trace"] != nil && len(meta["trace"].([]string)) > 0 {
  51. for _, msg := range meta["trace"].([]string) {
  52. logger.Error(msg)
  53. }
  54. }
  55. logger.Warn(meta["columns"])
  56. }
  57. }*/
  58. //rst,meta,err := g.Query(`insert into /matrix/entity/hmc (id, config, host, name) values ("hmc:node3", {"list":"/testorg0"}, "wecise", "唯简")`)
  59. //rst,meta,err := g.Query(`insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '作业控制台', null, null, '2020-04-21', null, 'Job', {'group':'application'}, 'job.png', '8814723100569440912', '作业控制台', null, null, 742, 0, 0, null, '_parent', '/matrix/job', '2020-04-21')`)
  60. //rst,meta,err := g.Query(`INSERT into /matrix/entity/interface (id, interface_perf) values ("interface:RWU9451-900439-1_X2",["121.136.24.126",4.05345935041445,1.28524571646452,"x2"]) at "2020-12-06 18:14:30";`)
  61. //rst,meta,err := g.Query(`insert into /matrix/portal/tools (app, belongto, class, cnname, connect, contain, day, depend, enname, fail, groups, icon, name, refer, runon, seat, selected, status, success, tags, target, url, vtime) values ('', null, '/matrix/portal/tools', '对象管理', null, null, '2021-01-22', null, 'OMDB', null, {'group':'system'}, 'omdb.png', '对象管理', null, null, 316, 0, 0, null, null, '_parent', '/matrix/omdb', 1611280343479)`)
  62. //rst,meta,err := g.Query(`insert into /matrix/entity/itm (id, disk_perf) values ('itm:node3', ["/opt",5,5.5,5,5]) at ""`)
  63. /*
  64. rst,meta,err := g.Query(`
  65. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '作业控制台', null, null, '2020-04-21', null, 'Job', {'group':'application'}, 'job.png', '8814723100569440912', '作业控制台', null, null, 742, 0, 0, null, '_parent', '/matrix/job', 1587429719340);
  66. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '事件控制台', null, null, '2020-04-21', null, 'Event', {'group':'application'}, 'event.png', '729969318835110277', '事件控制台', null, null, 742, 0, 0, null, '_parent', '/matrix/event', 1587429714557);
  67. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '性能管理', null, null, '2020-04-21', null, 'Performance', {'group':'application'}, 'performance.png', '6626348897731864077', '性能管理', null, null, 742, 0, 0, null, '_parent', '/matrix/performance', 1587429737986);
  68. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '服务面板', null, null, '2020-04-22', null, 'Summary', {'group':'system'}, 'summary.png', '4323757888248230414', '服务面板', null, null, 753, 0, 0, null, '_parent', '/matrix/summary', 1587539721889);
  69. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '实体管理', null, null, '2020-04-21', null, 'Entity', {'group':'system'}, 'cmdb.png', '3688202906988096307', '实体管理', null, null, 742, 0, 0, null, '_parent', '/matrix/entity', 1587429728283);
  70. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '探针管理', null, null, '2020-04-21', null, 'Probe', {'group':'application'}, 'probe.png', '18054631475080762941', '探针管理', null, null, 742, 0, 0, null, '_parent', '/matrix/probe', 1587429748533);
  71. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '配置管理', null, null, '2020-04-21', null, 'Config', {'group':'system'}, 'config.png', '16189993373364741387', '配置管理', null, null, 742, 0, 0, null, '_parent', '/matrix/config', 1587429765684);
  72. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '创作中心', null, null, '2020-04-21', null, 'Creative', {'group':'system'}, 'creative.png', '15919268718129958720', '创作中心', null, null, 742, 0, 0, null, '_parent', '/matrix/creative', 1587429724251);
  73. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '拓扑管理', null, null, '2020-04-21', null, 'Topological', {'group':'application'}, 'topological.png', '15604217246982015482', '拓扑管理', null, null, 742, 0, 0, null, '_parent', '/matrix/topological', 1587429743828);
  74. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', 'AI', null, null, '2020-04-21', null, 'AI', {'group':'system'}, 'ai.png', '14571201506270844621', 'AI', null, null, 742, 0, 0, null, '_parent', '/matrix/ai', 1587429770100);
  75. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '接口管理', null, null, '2020-04-21', null, 'API', {'group':'system'}, 'api.png', '14236690317582057583', '接口管理', null, null, 742, 0, 0, null, '_parent', '/matrix/api', 1587429752597);
  76. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '对象管理', null, null, '2020-04-21', null, 'OMDB', {'group':'system'}, 'omdb.png', '12822081807082780277', '对象管理', null, null, 742, 0, 0, null, '_parent', '/matrix/omdb', 1587429732563);
  77. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '系统管理', null, null, '2020-04-21', null, 'System', {'group':'system'}, 'system.png', '1235630703358807193', '系统管理', null, null, 742, 0, 0, null, '_parent', '/matrix/system', 1587429761592);
  78. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '我的文档', null, null, '2020-04-22', null, 'Notes', {'group':'system'}, 'notes.png', '12071602268450073202', '我的文档', null, null, 753, 0, 0, null, '_parent', '/matrix/notes', 1587539869396);
  79. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '类设计器', null, null, '2020-04-22', null, 'ClassDesign', {'group':'system'}, 'class.png', '10874969328088167307', '类设计器', null, null, 753, 0, 0, null, '_parent', '/matrix/classDesign', 1587539879365);
  80. insert into /matrix/portal/tools (class, cnname, connect, contain, day, depend, enname, groups, icon, id, name, refer, runon, seat, selected, status, tags, target, url, vtime) values ('/matrix/portal/tools', '日志管理', null, null, '2020-04-21', null, 'Log', {'group':'system'}, 'log.png', '10274964635279100928', '日志管理', null, null, 742, 0, 0, null, '_parent', '/matrix/log', 1587429757116);
  81. insert into /matrix/system/subscribe (apps, name, source, status, subject, title, users) values ('matrix', '词频预警', 'AI', 0, 'CPYJ', '词频预警', 'admin');
  82. insert into /matrix/system/subscribe (apps, name, source, status, subject, title, users) values ('matrix', '基线计算分析', 'AI', 0, 'BASELINE', '基线计算分析', 'admin');
  83. `)*/
  84. //rst,meta,err := g.Query(`insert into /matrix/test (day,id,name,vtime) values (1123443225,'aaaa', '测试',1123443225);`)
  85. //rst,meta,err := g.Query(` insert into /matrix/testbucket6 (id, bkdata) values ('linux:wecise', [1, 2, 3.3, 6.5, 'abhh34','gjjcc'] ) at '2021-03-19 02:28:15'`)
  86. //rst,meta,err := g.Query(`insert into /matrix/test/collect (v_varchar, v_map, v_list, d_list, f_list, i_list, v_set, v_type ) values ('1', {"map1": "val1", "map2":"2"}, ["list1", "list2"], ["2.15", "2.15"], ["3.16", "3.16"], ["11", "12"], ["set1", "set2"], "4" )`)
  87. //rst,meta,err := g.Query(`insert into /test/malert_status_seq (identifier,agent, node,vtime) values('222.129.134.178.1.3.6.1.4.1.2011.5.25.219.2.5.665.25.219.2.5.6','huawei mttrapd', '222.129.134.178','2023-03-06') on conflict sequence`)
  88. /*rst, meta, err := g.Query(`insert into /matrix/system/depot (command, day, depend, name, refer, remark, runon, status, tags, version, vtime) values ('tar zxvf /opt/matrix/agent/depot/matrix/toev2/toev2.tar.gz -C /opt/matrix/;
  89. ln -s /opt/matrix/agent/depot/ /opt/matrix/toev2/agent/depot;
  90. ln -s /opt/matrix/repo/matrix/ /opt/matrix/toev2/repo/matrix;
  91. (crontab -l;echo "30 7 * * * sh /opt/matrix/toev2/sbin/ythyw-auto-start-v2.sh") | crontab && crontab -l', '2022-12-27', null, 'toev2', null, '新版代理', null, 0, null, '1.0.0', 1672132329496);`)
  92. */
  93. rst, meta, err := g.Query(`insert into /test/bucketpromdbmp (id, prommp) values ('bucketpromdbmp:wecise11', [{ '__name__':'key1.key2.key0', '__value__':2, '__timestamp__':'2022-11-28 11:24:00', 'disk':'/opt/matrix', 'CPU':'CPU1'}])`)
  94. /*rst,meta,err := g.Query(`insert into /matrix/entity/linux (id,disk_perf) values ("linux:node3",["/",30,55,58,54.31388979126818,69.16669973257089]) at '2021-04-01 23:43:05.519';
  95. insert into /matrix/entity/linux (id,disk_perf) values ("linux:node3",["/",30,55,58,54.31388979126818,69.16669973257089]) at '2021-04-01 20:43:05.519';
  96. insert into /matrix/entity/linux (id,disk_perf) values ("linux:node3",["/",30,55,58,54.31388979126818,69.16669973257089]) at '2021-04-01 12:43:05.519';
  97. insert into /matrix/entity/linux (id,disk_perf) values ("linux:node3",["/",30,55,58,54.31388979126818,69.16669973257089]) at '2021-04-01 00:43:05.519';`)*/
  98. /*rst,meta,err := g.Query(`insert into /matrix/test/bucketlog (id, bklog['file1.log']) values ('linux:wecise', ["1-1--DEBUG [CompactionExecutor:584] 2020-07-25 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables", "1-2--DEBUG [CompactionExecutor:583] 2020-07-25 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables", "1-3--DEBUG [CompactionExecutor:584] 2020-07-25 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables", "1-4--DEBUG [CompactionExecutor:583] 2020-07-25 00:49:59,666 TimeWindowCompactionStrategy.java:117 - TWCS expired check sufficiently far in the past, checking for fully expired SSTables", "1-5--DEBUG [CompactionExecutor:583] 2020-07-25 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables", "1-6--DEBUG [CompactionExecutor:583] 2020-07-25 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables", "1-7--WARN [Native-Transport-Requests-1] 2020-07-25 00:50:01,043 SelectStatement.java:429 - Aggregation query used without partition key", "1-8--WARN [Native-Transport-Requests-1] 2020-07-25 00:50:04,072 SelectStatement.java:429 - Aggregation query used without partition key", "1-9--INFO [Thread-3] 2020-07-25 00:50:08,837 IndexMatrixSchema.java:143 - [object] No need to add fields", "1-10--INFO [Thread-8] 2020-07-25 00:50:08,840 IndexMatrixSchema.java:143 - [vobject] No need to add fields"])`)*/
  99. /*rst,meta,err := g.Query(`
  100. insert into /matrix/test/bucketlog (id, bklog['file1.log']) values ('linux:wecise', [['[2021-06-16 00:00:00.608072][22264][2419] Level 0 :
  101. -----------------------------------------------------------
  102. 报文放置时间:[2021-06-16 00:00:00.560000] 报文读取时间:[2021-06-15 23:59:59.930309] 处理报文时间:[2021-06-16 00:00:00.574163] 处理报文耗时:[33.876000]ms
  103. 接收报文:
  104. {H:01102100099996IBPS0000 IBPS20210616000000XMLmaps.305.001.01 00200000000755039990002000000007550399903U XN}
  105. <?xml version="1.0" encoding="UTF-8"?>
  106. <Document xmlns="urn:cnaps:std:ibps:2010:tech:xsd:maps.305.001.01" xmlns:xs="http://www.w3.org/2001/XMLSchema"><TxStsReq><GrpHdr><MsgId>1021000999962021061671777836</MsgId><CreDtTm>2021-06-16T00:00:00</CreDtTm></GrpHdr><InstgPty>102100099996</InstgPty><InstdPty>0000</InstdPty><ActTxStsInf><OrgnlGrpInf><OrgnlSndrId>102100099996</OrgnlSndrId><OrgnlMsgId>1021000999962021061573825160</OrgnlMsgId></OrgnlGrpInf><OrgnlMsgTp>maps.301.001.01</OrgnlMsgTp><AcctInf><Acct>6222021001115891274</Acct><Tel>18701506942</Tel></AcctInf></ActTxStsInf><DgtSgntr>MEQCIB5I003cIktpaEuvgZD3rUwVciJEA8wT3T32UOEsiOPvAiAJSO/Hb66S3djGa3BV8Uw/A2oSG/CWJB/EO8xjFVnN9g==</DgtSgntr></TxStsReq></Document>
  107. 处理结果:
  108. ** IB1I0000[处理成功!] **
  109. [2021-06-16 00:00:00.641788][22264][1989] Level 0 :
  110. -----------------------------------------------------------
  111. 报文放置时间:[2021-06-16 00:00:00.560000] 报文读取时间:[2021-06-16 00:00:00.608745] 处理报文时间:[2021-06-16 00:00:00.611142] 处理报文耗时:[30.622000]ms
  112. 接收报文:
  113. {H:01102100099996IBPS0000 IBPS20210616000000XMLmaps.305.001.01 00250000000754136018002500000007541360183U XN}
  114. <?xml version="1.0" encoding="UTF-8"?>
  115. <Document xmlns="urn:cnaps:std:ibps:2010:tech:xsd:maps.305.001.01" xmlns:xs="http://www.w3.org/2001/XMLSchema"><TxStsReq><GrpHdr><MsgId>1021000999962021061685784366</MsgId><CreDtTm>2021-06-16T00:00:00</CreDtTm></GrpHdr><InstgPty>102100099996</InstgPty><InstdPty>0000</InstdPty><ActTxStsInf><OrgnlGrpInf><OrgnlSndrId>102100099996</OrgnlSndrId><OrgnlMsgId>1021000999962021061589128394</OrgnlMsgId></OrgnlGrpInf><OrgnlMsgTp>maps.301.001.01</OrgnlMsgTp><AcctInf><Acct>6212254200002880163</Acct><Tel>15584466023</Tel></AcctInf></ActTxStsInf><DgtSgntr>MEQCIHKi86xIMVUIG49/yJWagOZURxNXrtKsOaTVQJ1COXjLAiA0b9rvuS1sevfw0UlRw9zReAwJGwuUDuntSHJ0lj0HSA==</DgtSgntr></TxStsReq></Document>
  116. 处理结果:
  117. ** IB1I0000[处理成功!] **
  118. [2021-06-17 00:00:00.672518][22264][2025] Level 0 :
  119. -----------------------------------------------------------
  120. 报文放置时间:[2021-06-16 00:00:00.580000] 报文读取时间:[2021-06-16 00:00:00.642211] 处理报文时间:[2021-06-16 00:00:00.644378] 处理报文耗时:[28.115000]ms
  121. 接收报文:
  122. {H:01102100099996IBPS0000 IBPS20210616000000XMLmaps.305.001.01 00100000000755018043001000000007550180433U XN}
  123. <?xml version="1.0" encoding="UTF-8"?>
  124. <Document xmlns="urn:cnaps:std:ibps:2010:tech:xsd:maps.305.001.01" xmlns:xs="http://www.w3.org/2001/XMLSchema"><TxStsReq><GrpHdr><MsgId>1021000999962021061671777838</MsgId><CreDtTm>2021-06-16T00:00:00</CreDtTm></GrpHdr><InstgPty>102100099996</InstgPty><InstdPty>0000</InstdPty><ActTxStsInf><OrgnlGrpInf><OrgnlSndrId>102100099996</OrgnlSndrId><OrgnlMsgId>1021000999962021061578736719</OrgnlMsgId></OrgnlGrpInf><OrgnlMsgTp>maps.301.001.01</OrgnlMsgTp><AcctInf><Acct>6222033700004634556</Acct><Tel>18092609666</Tel></AcctInf></ActTxStsInf><DgtSgntr>MEQCIBQa1SoH2A6kQTf6gHPqzgPdj1FDJkEp7mNWYw1iF2DBAiAEkYFlcGF3ZU15Rsn2BygIr8F+D7O4Kv69QxM8yHIZeQ==</DgtSgntr></TxStsReq></Document>
  125. 处理结果:
  126. ** IB1I0000[处理成功!] **
  127. '] ] ) with split=/\n\n/
  128. `)*/
  129. //rst,meta,err := g.Query(`alter class clickcount add index column MachineClass MachineClass`)
  130. //rst,meta,err := g.Query(`insert into clickcount (MachineClass) values ('MACHINING_CENTRE')`)
  131. //rst,meta,err := g.Query(`select MachineClass from clickcount where MachineClass='MACHINING_CENTRE'`)
  132. /*g.Register( "CLASS_DATA_CHANGE:/matrix/devops/change@matrix", "/matrix/devops/change", "insert" )
  133. rst,meta,err := g.Query(` insert into /matrix/devops/change (workordernum) values ('test1')`)
  134. g.UnRegister( "CLASS_DATA_CHANGE:/matrix/devops/change@matrix", "/matrix/devops/change", "insert" )*/
  135. /*rst,meta,err := g.Query(`insert into /matrix/devops/alert_status (acknowledged, agent, alarmtype, alertgroup, alertkey, alertsubtype, alerttype, belongto, bname, bsm_classname, bsm_identity, bsm_subidentity, businessimpact, bussinesscategory, causetype, ccpc, ccpcbank, ciid, cmdbenrichstatus, cname, cnsummary, connect, contact, contactman, contactphone, contain, corrscore, customer, day, depend, deploy, devicelocation, devicemodel, devicepurpose, devicetype, dim, domaingroup, domainsubgroup, duration, emailstatus, entity, eventclass, eventid, eventstatus, eventtime, eventtype, evtproccode, expiretime, explain, extendedattr, fail, firstoccurrence, flag, flash, grade, id, identifier, idname, impactflag, install, instance, internallast, lastoccurrence, linux, localnodealias, localobjrelate, localpriobj, localrootobj, localsecobj, localtertobj, location, logticket, lpar, machineid, maintainstatus, maintenance, manager, market, monitor, msg_id, n_maintenance_status, name, netype, nmoscausetype, nmosdomainname, nmosentityid, nmoseventmap, nmosmanagedstatus, nmosobjinst, nmosserial, node, nodealias, nodename, nodetype, objectfullname, oldrow, omni_class, omni_serial, orgcode, originalseverity, ownergid, owneruid, phone, physicalcabinet, physicalcard, physicallocation, physicalport, physicalslot, plateng, platform, poll, probesubsecondid, processreq, recordtime, refer, region, relate, remotenodealias, remoteobjrelate, remotepriobj, remoterootobj, remotesecobj, remotetertobj, resolve, rowserial, runon, sendto, servername, serverserial, service, servicenowerrorcode, servicenowstate, servicenowsysid, severity, siteid, smsflag, statechange, status, submodel, subsystem, success, summary, suppressescl, syscode, sysplex, tags, tally, tasklist, ticketstatus, tiggerflag, tsrmflag, ttnumber, ttstate, ttuser, type, upgradeflag, url, vtime, wheel, wwheel, x733corrnotif, x733eventtype, x733probablecause, x733specificprob) values (0, '', '', '', '', 'Network', '', null, '', '', '', '', 0, '支行网络设备', 0, 0, '', '', 0, '辽阳路支行联通路由器', '', null, '', '路峰', '17663981994', null, 0, '', '2021-11-11', null, null, 'NULL', '', '', '', null, '', '', 0, 0, '', '', '', 0, '', 0, '', 0, '', '', null, 1614937870000, 0, 0, 0, '9994164945157663146', '10.16.144.111', '', 0, null, '', -6795364578871, 1614937870000, null, '', 0, '', '', '', '', 'NULL', 0, '', '', 0, 0, 'syslog', '', null, '', 0, '9994164945157663146', '', 0, '', 0, '', 0, 0, '', '10.16.144.11', '网络设备ping状态检测__级别红色', '', '', '', 0, '', 2195076, '', 5, 0, 0, '', '', '', '', 0, 0, '', '', 0, 0, 0, 0, null, '', null, '', 0, '', '', '', '', '', 0, null, null, 'NCOMS', 2195076, '', 0, 0, '', 5, '', 0, 1614937872000, 20, '', '', null, ' 网络设备ping状态检测__级别红色 10.16.144.11 03月05日17时51分08秒检测到10.16.144.11[liaoyangluZH_msr01]PING状态触发告警,当前PING状态是OFF。', 0, '', '', null, 1, 0, '', 0, 0, '', 0, '', 1, 0, '', 1636620464912, null, null, '', 0, 0, '');`)*/
  136. //rst,meta,err :=g.Query(`insert into /matrix/test/basic (id, name) values ('8056570966701428612', 'hello') on conflict update v_int=v_int+1 `)
  137. /*rst,meta,err :=g.Query(`
  138. insert into /test/bucketlog (id, bklog['file1.log']) values ('linux:wecise', ["1-1--DEBUG [CompactionExecutor:584] 2020-06-25 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  139. 1-2--DEBUG [CompactionExecutor:583] 2020-06-25 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  140. 1-3--DEBUG [CompactionExecutor:584] 2020-06-25 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  141. 1-4--DEBUG [CompactionExecutor:583] 2020-06-25 00:49:59,666 TimeWindowCompactionStrategy.java:117 - TWCS expired check sufficiently far in the past, checking for fully expired SSTables
  142. 1-5--DEBUG [CompactionExecutor:583] 2020-06-25 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  143. 1-6--DEBUG [CompactionExecutor:583] 2020-06-25 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  144. 1-7--WARN [Native-Transport-Requests-1] 2020-06-25 00:50:01,043 SelectStatement.java:429 - Aggregation query used without partition key
  145. 1-8--WARN [Native-Transport-Requests-1] 2020-06-25 00:50:04,072 SelectStatement.java:429 - Aggregation query used without partition key
  146. 1-9--INFO [Thread-3] 2020-06-25 00:50:08,837 IndexMatrixSchema.java:143 - [object] No need to add fields
  147. 1-10--INFO [Thread-8] 2020-06-25 00:50:08,840 IndexMatrixSchema.java:143 - [vobject] No need to add fields"])`)
  148. `)*/
  149. //g.Query(` insert into /matrix/testbucket6 (id, bkdata) values ('linux:wecise', [1, 3, 3.3, 6.5, 'abhh34','gjjcc'] ) at '2021-03-19 02:28:15'`)
  150. //insert into /matrix/entity/interface (id,interface_perf) values ('interface:RWU2216-2210-1_Port 3/8#node:RWU2216-2210-1', ['192.168.0.1',2.1,3.2,'Port 3']) at '2021-03-20 10:00:00'
  151. //rst,meta,err := g.Query(` insert into /matrix/perms/api (name, pprefix, pmatch, mtime, _group) values ('测试API权限', null, ["/script/temp/test/testperm.js"], 1593306396000, ["测试组"])`)
  152. //rst,meta,err := g.Query(` insert into /matrix/testbucket4 (id, bk2) values ('linux:wecise', [ [23, nil, 3.4, 6.68, '这是ggggg'], [33, nil, 3.4, 6.69, '这是ggggg4444'] ] ) at '2020-06-14 07:'`)
  153. //rst,meta,err := g.Query(` insert into /matrix/entity/it/it_linux (id,disk) values ("it_linux:192.168.190.174",["/",49,59,56,71.81841478366437,72.47003275260354]) at '2020-05-30 20:30:03.631'`)
  154. //rst,meta,err := g.Query(`insert into /test/donghuan/c (id,values) values ('192.168.174.231', [452,24.6,572,1024,75.4]) at '2020-05-20 00:40:00'`)
  155. //rst,meta,err := g.Query(` insert into /matrix/testbucket4 (id, host) values ('linux:wecise', 'wecise2' ) `)
  156. /* for i:=0 ; i<20 ;i++{
  157. rst,meta,err := g.Query(`insert into /matrix/entity/it/it_aix (id,disk_test) values ("it_aix:192.168.190.175",["2020-07-27 18:09:54.541","020-07-27","2020-07-27 18:09:54.541","020-07-27 18","020-07-27 18:09","020-07-27 18:09:54"]) at '2020-07-27 18:09:54.541'`)
  158. if err != nil {
  159. logger.Info("Query error:"+err.Error())
  160. logger.Warn(meta["type"])
  161. }else{
  162. logger.Info("rst ===>", rst)
  163. //logger.Error("meta ===>", meta)
  164. if meta["trace"] != nil && len(meta["trace"].([]string)) > 0 {
  165. for _, msg := range meta["trace"].([]string) {
  166. logger.Error(msg)
  167. }
  168. }
  169. logger.Warn(meta["columns"])
  170. }
  171. }
  172. */
  173. //rst,meta,err := g.Query(` insert into /test/donghuan/a (id, values['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20']) values ('ID906', [906,906,906,906,906,906,906,906,906,906,906,906,906,906,906,906,906,906,906,906]) at '2020-05-08 14:55:51'`)
  174. //rst,meta,err := g.Query(`insert into /matrix/entity/it/it_aix (id,logs2["aaa.log"]) values ('it_aix:192.168.190.175',["Aug 9 16:23:13 aaaabbbccc dddsss sss"]);`)
  175. //rst,meta,err := g.Query(` insert into /matrix/testbucket5 (id, host) values ('linux:wecise', 'wecise') `)
  176. /*rst,meta,err := g.Query(` insert into /matrix/testbucket5 (id, bklog['file1.log']) values ('linux:wecise', ["1-1--DEBUG [CompactionExecutor:584] 2020-06-25 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  177. 1-2--DEBUG [CompactionExecutor:583] 2020-06-25 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  178. 1-3--DEBUG [CompactionExecutor:584] 2020-06-25 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  179. 1-4--DEBUG [CompactionExecutor:583] 2020-06-2500:49:59,666 TimeWindowCompactionStrategy.java:117 - TWCS expired check sufficiently far in the past, checking for fully expired SSTables
  180. 1-5--DEBUG [CompactionExecutor:583] 2020-06-25 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  181. 1-6--DEBUG [CompactionExecutor:583] 2020-06-25 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  182. 1-7--WARN [Native-Transport-Requests-1] 2020-06-25 00:50:01,043 SelectStatement.java:429 - Aggregation query used without partition key
  183. 1-8--WARN [Native-Transport-Requests-1] 2020-06-25 00:50:04,072 SelectStatement.java:429 - Aggregation query used without partition key
  184. 1-9--INFO [Thread-3] 2020-06-25 00:50:08,837 IndexMatrixSchema.java:143 - [object] No need to add fields
  185. 1-10--INFO [Thread-8] 2020-06-25 00:50:08,840 IndexMatrixSchema.java:143 - [vobject] No need to add fields"])`)*/
  186. /*
  187. for _, k:= range []int{23, 24, 25, 26}{
  188. for j:=10 ;j<24 ;j++{
  189. for i:=10; i<60 ;i++ {
  190. for m:=10; m<60 ;m++ {
  191. rst,meta,err := g.Query(fmt.Sprintf(` insert into /matrix/testbucket5 (id, bklog['file1.log']) values ('linux:wecise', ["1-1--DEBUG [CompactionExecutor:584] 2020-06-%d %d:%d:%d,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  192. 1-2--DEBUG [CompactionExecutor:583] 2020-06-%d %d:%d:%d,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  193. 1-3--DEBUG [CompactionExecutor:584] 2020-06-%d %d:%d:%d,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  194. 1-4--DEBUG [CompactionExecutor:583] 2020-06-%d %d:%d:%d,666 TimeWindowCompactionStrategy.java:117 - TWCS expired check sufficiently far in the past, checking for fully expired SSTables
  195. 1-5--DEBUG [CompactionExecutor:583] 2020-06-%d %d:%d:%d,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  196. 1-6--DEBUG [CompactionExecutor:583] 2020-06-%d %d:%d:%d,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  197. 1-7--WARN [Native-Transport-Requests-1] 2020-06-%d %d:%d:%d,043 SelectStatement.java:429 - Aggregation query used without partition key
  198. 1-8--WARN [Native-Transport-Requests-1] 2020-06-%d %d:%d:%d,072 SelectStatement.java:429 - Aggregation query used without partition key
  199. 1-9--INFO [Thread-3] 2020-06-%d %d:%d:%d,837 IndexMatrixSchema.java:143 - [object] No need to add fields
  200. 1-10--INFO [Thread-8] 2020-06-%d %d:%d:%d,840 IndexMatrixSchema.java:143 - [vobject] No need to add fields"])`, k,j,i,m, k,j,i,m, k,j,i,m, k,j,i,m, k,j,i,m, k,j,i,m, k,j,i,m, k,j,i,m, k,j,i,m, k,j,i,m))
  201. if err != nil {
  202. logger.Info("Query error:"+err.Error())
  203. logger.Warn(meta["type"])
  204. }else{
  205. logger.Info("rst ===>", rst)
  206. //logger.Error("meta ===>", meta)
  207. if meta["trace"] != nil && len(meta["trace"].([]string)) > 0 {
  208. for _, msg := range meta["trace"].([]string) {
  209. logger.Error(msg)
  210. }
  211. }
  212. logger.Warn(meta["columns"])
  213. }
  214. }
  215. }
  216. }
  217. }
  218. */
  219. /*
  220. rst,meta,err := g.Query(` insert into /matrix/testbucket5 (id, bk2['file1.log']) values ('linux:wecise', ["2-1--DEBUG [CompactionExecutor:584] 2020-05-15 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  221. 2-2--DEBUG [CompactionExecutor:583] 2020-05-15 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  222. 2-3--DEBUG [CompactionExecutor:584] 2020-05-15 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  223. 2-4--DEBUG [CompactionExecutor:583] 2020-05-15 00:49:59,666 TimeWindowCompactionStrategy.java:117 - TWCS expired check sufficiently far in the past, checking for fully expired SSTables
  224. 2-5--DEBUG [CompactionExecutor:583] 2020-05-15 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  225. 2-6--DEBUG [CompactionExecutor:583] 2020-05-15 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  226. 2-7--WARN [Native-Transport-Requests-1] 2020-05-15 00:50:01,043 SelectStatement.java:429 - Aggregation query used without partition key
  227. 2-8--WARN [Native-Transport-Requests-1] 2020-05-15 00:50:04,072 SelectStatement.java:429 - Aggregation query used without partition key
  228. 2-9--INFO [Thread-3] 2020-05-15 00:50:08,837 IndexMatrixSchema.java:143 - [object] No need to add fields
  229. 2-10--INFO [Thread-8] 2020-05-15 00:50:08,840 IndexMatrixSchema.java:143 - [vobject] No need to add fields"])`)
  230. */
  231. /*
  232. rst,meta,err := g.Query(` insert into /matrix/testbucket5 (id, bk2['file2.log']) values ('linux:wecise', ["3-1--DEBUG [CompactionExecutor:584] 2020-05-16 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  233. 3-2--DEBUG [CompactionExecutor:583] 2020-05-16 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  234. 3-3--DEBUG [CompactionExecutor:584] 2020-05-16 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  235. 3-4--DEBUG [CompactionExecutor:583] 2020-05-16 00:49:59,666 TimeWindowCompactionStrategy.java:117 - TWCS expired check sufficiently far in the past, checking for fully expired SSTables
  236. 3-5--DEBUG [CompactionExecutor:583] 2020-05-16 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  237. 3-6--DEBUG [CompactionExecutor:583] 2020-05-16 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  238. 3-7--WARN [Native-Transport-Requests-1] 2020-05-16 00:50:01,043 SelectStatement.java:429 - Aggregation query used without partition key
  239. 3-8--WARN [Native-Transport-Requests-1] 2020-05-16 00:50:04,072 SelectStatement.java:429 - Aggregation query used without partition key
  240. 3-9--INFO [Thread-3] 2020-05-16 00:50:08,837 IndexMatrixSchema.java:143 - [object] No need to add fields
  241. 3-10--INFO [Thread-8] 2020-05-16 00:50:08,840 IndexMatrixSchema.java:143 - [vobject] No need to add fields"])`)*/
  242. /*
  243. rst,meta,err := g.Query(` insert into /matrix/testbucket7/subbk (id, bk2['file2.log']) values ('linux:wecise', ["3-1--DEBUG [CompactionExecutor:584] 05-16 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  244. 3-2--DEBUG [CompactionExecutor:583] 05-16 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  245. 3-3--DEBUG [CompactionExecutor:584] 05-16 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  246. 3-4--DEBUG [CompactionExecutor:583] 05-16 00:49:59,666 TimeWindowCompactionStrategy.java:117 - TWCS expired check sufficiently far in the past, checking for fully expired SSTables
  247. 3-5--DEBUG [CompactionExecutor:583] 05-16 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  248. 3-6--DEBUG [CompactionExecutor:583] 05-16 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  249. 3-7--WARN [Native-Transport-Requests-1] 05-16 00:50:01,043 SelectStatement.java:429 - Aggregation query used without partition key
  250. 3-8--WARN [Native-Transport-Requests-1] 05-16 00:50:04,072 SelectStatement.java:429 - Aggregation query used without partition key
  251. 3-9--INFO [Thread-3] 05-16 00:50:08,837 IndexMatrixSchema.java:143 - [object] No need to add fields
  252. 3-10--INFO [Thread-8] 05-16 00:50:08,840 IndexMatrixSchema.java:143 - [vobject] No need to add fields"])`)*/
  253. //rst,meta,err := g.Query(`insert into /matrix/entity/itm (id,logs["/home/matrix/logs/ncolog-20200426"]) values ("itm:test",["16.0.65.54 2020 hostname"])`)
  254. /*
  255. rst,meta,err := g.Query(` insert into /matrix/testbucket5 (id, bk2['file1.log']) values ('linux:wecise', ["
  256. 4-1--DEBUG [CompactionExecutor:584] 2020-05-17 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  257. 4-2--DEBUG [CompactionExecutor:583] 2020-05-17 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  258. 4-3--DEBUG [CompactionExecutor:584] 2020-05-17 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  259. 4-4--DEBUG [CompactionExecutor:583] 2020-05-17 00:49:59,666 TimeWindowCompactionStrategy.java:117 - TWCS expired check sufficiently far in the past, checking for fully expired SSTables
  260. 4-5--DEBUG [CompactionExecutor:583] 2020-05-17 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  261. 4-6--DEBUG [CompactionExecutor:583] 2020-05-17 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  262. 4-7--WARN [Native-Transport-Requests-1] 2020-05-17 00:50:01,043 SelectStatement.java:429 - Aggregation query used without partition key
  263. 4-8--WARN [Native-Transport-Requests-1] 2020-05-17 00:50:04,072 SelectStatement.java:429 - Aggregation query used without partition key
  264. 4-9--INFO [Thread-3] 2020-05-17 00:50:08,837 IndexMatrixSchema.java:143 - [object] No need to add fields
  265. 4-10--INFO [Thread-8] 2020-05-17 00:50:08,840 IndexMatrixSchema.java:143 - [vobject] No need to add fields"])`)*/
  266. /*rst,meta,err := g.Query(` insert into /matrix/testbucket5 (id, bk2['file1.log']) values ('linux:wecise', ["DEBUG [CompactionExecutor:584] 2020-05-18 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  267. DEBUG [CompactionExecutor:583] 2020-05-18 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  268. DEBUG [CompactionExecutor:584] 2020-05-18 00:49:59,666 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  269. DEBUG [CompactionExecutor:583] 2020-05-18 00:49:59,666 TimeWindowCompactionStrategy.java:117 - TWCS expired check sufficiently far in the past, checking for fully expired SSTables
  270. DEBUG [CompactionExecutor:583] 2020-05-18 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  271. DEBUG [CompactionExecutor:583] 2020-05-18 00:49:59,667 TimeWindowCompactionStrategy.java:124 - TWCS skipping check for fully expired SSTables
  272. WARN [Native-Transport-Requests-1] 2020-05-18 00:50:01,043 SelectStatement.java:429 - Aggregation query used without partition key
  273. WARN [Native-Transport-Requests-1] 2020-05-18 00:50:04,072 SelectStatement.java:429 - Aggregation query used without partition key
  274. INFO [Thread-3] 2020-05-18 00:50:08,837 IndexMatrixSchema.java:143 - [object] No need to add fields
  275. INFO [Thread-8] 2020-05-18 00:50:08,840 IndexMatrixSchema.java:143 - [vobject] No need to add fields
  276. WARN [Native-Transport-Requests-2] 2020-05-18 00:50:14,231 SelectStatement.java:429 - Aggregation query used without partition key
  277. WARN [Native-Transport-Requests-2] 2020-05-18 00:50:31,326 SelectStatement.java:429 - Aggregation query used without partition key
  278. WARN [Native-Transport-Requests-1] 2020-05-18 00:50:34,163 SelectStatement.java:429 - Aggregation query used without partition key
  279. WARN [Native-Transport-Requests-1] 2020-05-18 00:50:44,342 SelectStatement.java:429 - Aggregation query used without partition key"])`)*/
  280. //rst,meta,err := g.Query(` insert into /matrix/testbucket4 (id, host) values ('linux:wecise','wecise') `)
  281. /*for _, k:= range []string{"23", "24", "25", "26", "27", "28", "29", "30"}{
  282. for j:=0 ;j<24 ;j++{
  283. for i:=0; i<60 ;i++ {
  284. r := rand.New(rand.NewSource(time.Now().UnixNano()))
  285. sql := fmt.Sprintf( `insert into /matrix/testbucket4 (id, bk2) values ('12935154896484640018', [%d, %d, %f, %f, '12345678'] ) at '2020-04-%s %s:14:%s'`, r.Intn(100), r.Intn(100000), r.Float32(), r.Float32(), k, strconv.Itoa(j), strconv.Itoa(i))
  286. g.Query(sql)
  287. }
  288. }
  289. }*/
  290. /*rst,meta,err := g.Query(`
  291. insert into /matrix/testbucket (id, bk2) values ('17515269981487313961', [2, nil, 3.5, 6.6, '1234567890'] ) at 1587514140000
  292. `)*/
  293. //rst,err := g.Query(`insert edge (host:测试服务器1, app:weblogic1), (host:测试服务器2, app:weblogic2) with contain`)
  294. //rst,_,err := g.Query(`insert edge from host:测试服务器1, app:weblogic1 to host:测试服务器2, app:weblogic2 with contain {this is test option}`)
  295. //rst,meta,err := g.Query(`insert into /matrix/testgroup g1='g1' , g2='g2', g3='g34' , v1=1 , v2=2 , f1=1.1 , f2=1.2`)
  296. //rst,meta,err := g.Query(`Insert into /matrix/portal/tools name='对象管理' cnname='对象管理' enname='OMDB' icon='omdb.png' seat=10 selected=0 url='/janesware/omdb'`)
  297. //rst,meta,err := g.Query(`insert into /matrix/entity/linux (id, contain) values ('linux:wecise',["app:cassandra1"])`)
  298. //rst,err := g.Query(`Insert into /matrix/flowmark/btndef script='return "hello" ',name='test',wfid=-1 `,false)
  299. if err != nil {
  300. logger.Info("Query error:" + err.Error())
  301. logger.Warn(meta["type"])
  302. } else {
  303. logger.Info("rst ===>", rst)
  304. //logger.Error("meta ===>", meta)
  305. if meta["trace"] != nil && len(meta["trace"].([]string)) > 0 {
  306. for _, msg := range meta["trace"].([]string) {
  307. logger.Error(msg)
  308. }
  309. }
  310. logger.Warn(meta["columns"])
  311. }
  312. }