diff --git a/docs/examples/rust/restexample/examples/tmq.rs b/docs/examples/rust/restexample/examples/tmq.rs index 61416133e3..8586bbc5c7 100644 --- a/docs/examples/rust/restexample/examples/tmq.rs +++ b/docs/examples/rust/restexample/examples/tmq.rs @@ -83,7 +83,6 @@ async fn main() -> anyhow::Result<()> { eprintln!("Failed to execute insert: {:?}", e); } tokio::time::sleep(Duration::from_millis(10)).await; - println!("Succed to execute insert 1 row"); } }); }); diff --git a/docs/zh/07-develop/index.md b/docs/zh/07-develop/index.md index 9d4adce01c..4759027344 100644 --- a/docs/zh/07-develop/index.md +++ b/docs/zh/07-develop/index.md @@ -14,7 +14,8 @@ description: 让开发者能够快速上手的指南 7. 在很多场景下(如车辆管理),应用需要获取每个数据采集点的最新状态,那么建议你采用 TDengine 的 Cache 功能,而不用单独部署 Redis 等缓存软件。 8. 如果你发现 TDengine 的函数无法满足你的要求,那么你可以使用用户自定义函数(UDF)来解决问题。 -本部分内容就是按照上述顺序组织的。为便于理解,TDengine 为每个功能和每个支持的编程语言都提供了示例代码。如果你希望深入了解 SQL 的使用,需要查看[SQL 手册](../reference/taos-sql/)。如果想更深入地了解各连接器的使用,请阅读[连接器参考指南](../reference/connector/)。如果还希望想将 TDengine 与第三方系统集成起来,比如 Grafana, 请参考[第三方工具](../third-party/)。 +本部分内容就是按照上述顺序组织的。为便于理解,TDengine 为每个功能和每个支持的编程语言都提供了示例代码,位于 [示例代码](https://github.com/taosdata/TDengine/tree/main/docs/examples)。所有示例代码都会有 CI 保证正确性,脚本位于 [示例代码 CI](https://github.com/taosdata/TDengine/tree/main/tests/docs-examples-test)。 +如果你希望深入了解 SQL 的使用,需要查看[SQL 手册](../reference/taos-sql/)。如果想更深入地了解各连接器的使用,请阅读[连接器参考指南](../reference/connector/)。如果还希望想将 TDengine 与第三方系统集成起来,比如 Grafana, 请参考[第三方工具](../third-party/)。 如果在开发过程中遇到任何问题,请点击每个页面下方的["反馈问题"](https://github.com/taosdata/TDengine/issues/new/choose), 在 GitHub 上直接递交 Issue。 diff --git a/tests/docs-examples-test/rust.sh b/tests/docs-examples-test/rust.sh new file mode 100644 index 0000000000..91489d8bcd --- /dev/null +++ b/tests/docs-examples-test/rust.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +set -e + + +check_transactions() { + for i in {1..30} + do + output=$(taos -s "show transactions;") + if [[ $output == *"Query OK, 0 row(s)"* ]]; then + echo "Success: No transactions are in progress." + return 0 + fi + sleep 1 + done + + echo "Error: Transactions are still in progress after 30 attempts." + return 1 +} + +reset_cache() { + response=$(curl --location -uroot:taosdata 'http://127.0.0.1:6041/rest/sql' --data 'reset query cache') + + if [[ $response == \{\"code\":0* ]]; then + echo "Success: Query cache reset successfully." + else + echo "Error: Failed to reset query cache. Response: $response" + return 1 + fi +} + +taosd >>/dev/null 2>&1 & +taosadapter >>/dev/null 2>&1 & + +sleep 5 + +cd ../../docs/examples/rust/nativeexample + +cargo run --example connect + +cargo run --example createdb + +cargo run --example insert + +cargo run --example query + +taos -s "drop database if exists power" +check_transactions || exit 1 +reset_cache || exit 1 + +cargo run --example schemaless + +taos -s "drop database if exists power" +check_transactions || exit 1 +reset_cache || exit 1 + + +cargo run --example stmt + +cargo run --example tmq + + + +cd ../restexample + +cargo run --example connect + +cargo run --example createdb + +cargo run --example insert + +cargo run --example query + +taos -s "drop database if exists power" +check_transactions || exit 1 +reset_cache || exit 1 +taos -s "create database if not exists power" +cargo run --example schemaless + +taos -s "drop database if exists power" +check_transactions || exit 1 +reset_cache || exit 1 + + +cargo run --example stmt + +cargo run --example tmq diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 40f2fa3ead..602ac9ad66 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1557,5 +1557,6 @@ #,,n,docs-examples-test,bash node.sh ,,n,docs-examples-test,bash csharp.sh ,,n,docs-examples-test,bash jdbc.sh +,,n,docs-examples-test,bash rust.sh ,,n,docs-examples-test,bash go.sh ,,n,docs-examples-test,bash test_R.sh