modify node ci example
This commit is contained in:
parent
63d62fdfd3
commit
a4b35af11b
|
@ -4,8 +4,6 @@
|
|||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tdengine/client": "^3.0.1",
|
||||
"@tdengine/rest": "^3.0.0",
|
||||
"@tdengine/websocket": "^3.1.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,9 +92,11 @@ async function all_type_example() {
|
|||
}
|
||||
|
||||
async function test() {
|
||||
console.log("begin all_type_query")
|
||||
await json_tag_example()
|
||||
await all_type_example()
|
||||
taos.destroy();
|
||||
console.log("end all_type_query")
|
||||
}
|
||||
|
||||
test()
|
||||
|
|
|
@ -139,9 +139,11 @@ async function all_type_example() {
|
|||
}
|
||||
|
||||
async function test() {
|
||||
console.log("begin all_type_stmt")
|
||||
await json_tag_example()
|
||||
await all_type_example()
|
||||
taos.destroy();
|
||||
console.log("end all_type_stmt")
|
||||
}
|
||||
|
||||
test()
|
||||
|
|
|
@ -51,7 +51,9 @@ async function schemalessInsert() {
|
|||
}
|
||||
|
||||
async function test() {
|
||||
console.log("begin json_line_example")
|
||||
await schemalessInsert();
|
||||
console.log("end json_line_example")
|
||||
}
|
||||
|
||||
test()
|
|
@ -43,7 +43,9 @@ async function schemalessInsert() {
|
|||
}
|
||||
|
||||
async function test() {
|
||||
await schemalessInsert();
|
||||
console.log("begin line_example")
|
||||
await schemalessInsert();
|
||||
console.log("end line_example")
|
||||
}
|
||||
|
||||
test()
|
||||
|
|
|
@ -74,7 +74,9 @@ async function execSql() {
|
|||
}
|
||||
|
||||
async function test() {
|
||||
console.log("begin nodejsChecker")
|
||||
await execSql();
|
||||
console.log("end nodejsChecker")
|
||||
}
|
||||
|
||||
test()
|
|
@ -136,11 +136,13 @@ async function sqlWithReqid() {
|
|||
// ANCHOR_END: sqlWithReqid
|
||||
|
||||
async function test() {
|
||||
console.log("begin sql_example")
|
||||
await createDbAndTable();
|
||||
await insertData();
|
||||
await queryData();
|
||||
await sqlWithReqid();
|
||||
taos.destroy();
|
||||
console.log("end sql_example")
|
||||
}
|
||||
|
||||
test()
|
||||
|
|
|
@ -74,7 +74,9 @@ async function stmtInsert() {
|
|||
}
|
||||
|
||||
async function test () {
|
||||
console.log("begin stmt_example")
|
||||
await stmtInsert();
|
||||
console.log("end stmt_example")
|
||||
}
|
||||
|
||||
test()
|
|
@ -58,7 +58,9 @@ async function schemalessInsert() {
|
|||
}
|
||||
|
||||
async function test() {
|
||||
console.log("begin telnet_line_example")
|
||||
await schemalessInsert();
|
||||
console.log("end telnet_line_example")
|
||||
}
|
||||
|
||||
test()
|
|
@ -1,3 +1,4 @@
|
|||
const { sleep } = require("@tdengine/websocket");
|
||||
const taos = require("@tdengine/websocket");
|
||||
|
||||
// ANCHOR: create_consumer
|
||||
|
@ -49,10 +50,18 @@ async function prepare() {
|
|||
|
||||
let createTopic = `CREATE TOPIC IF NOT EXISTS ${topics[0]} AS SELECT * FROM ${db}.${stable}`;
|
||||
await wsSql.exec(createTopic);
|
||||
wsSql.close();
|
||||
}
|
||||
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
async function insert() {
|
||||
let conf = new taos.WSConfig('ws://localhost:6041');
|
||||
conf.setUser('root');
|
||||
conf.setPwd('taosdata');
|
||||
conf.setDb('power');
|
||||
let wsSql = await taos.sqlConnect(conf);
|
||||
for (let i = 0; i < 50; i++) {
|
||||
await wsSql.exec(`INSERT INTO d1001 USING ${stable} (location, groupId) TAGS ("California.SanFrancisco", 3) VALUES (NOW, ${10 + i}, ${200 + i}, ${0.32 + i})`);
|
||||
await sleep(100);
|
||||
}
|
||||
wsSql.close();
|
||||
}
|
||||
|
@ -82,8 +91,11 @@ async function consumer() {
|
|||
let consumer = null;
|
||||
try {
|
||||
await prepare();
|
||||
consumer = await createConsumer()
|
||||
await subscribe(consumer)
|
||||
consumer = await createConsumer();
|
||||
const allPromises = [];
|
||||
allPromises.push(subscribe(consumer));
|
||||
allPromises.push(insert());
|
||||
await Promise.all(allPromises);
|
||||
await consumer.unsubscribe();
|
||||
console.log("Consumer unsubscribed successfully.");
|
||||
}
|
||||
|
@ -102,7 +114,9 @@ async function consumer() {
|
|||
}
|
||||
|
||||
async function test() {
|
||||
await consumer();
|
||||
console.log("begin tmq_example")
|
||||
await consumer();
|
||||
console.log("end tmq_example")
|
||||
}
|
||||
|
||||
test()
|
||||
|
|
|
@ -101,7 +101,9 @@ async function consumer() {
|
|||
// ANCHOR_END: offset
|
||||
|
||||
async function test() {
|
||||
console.log("begin tmq_seek_example")
|
||||
await consumer();
|
||||
console.log("end tmq_seek_example")
|
||||
}
|
||||
|
||||
test()
|
||||
|
|
Loading…
Reference in New Issue