Go Client Examples

These examples are packages in the main github.com/apache/iotdb-client-go/v2 module. They require Go 1.25 or later and can be run directly from a repository checkout.

The main module contains the Session client, database/sql driver, and subscription packages. Existing imports, including github.com/apache/iotdb-client-go/v2/client and github.com/apache/iotdb-client-go/v2/database, are unchanged.

ExampleCommand from this directory
Tree Sessiongo run .
Table Sessiongo run ./table
Tree Session poolgo run ./session_pool
Table Session poolgo run ./session_pool/table
database/sqlgo run ./database_sql
Tree record subscriptionsgo run ./subscription/tree
Table record subscriptionsgo run ./subscription/table
Tree incremental subscriptionsgo run ./subscription/tree/incremental
Table incremental subscriptionsgo run ./subscription/table/incremental

These programs connect to IoTDB and create or modify sample data. Connection settings for the existing Session, pool, and database/sql examples are defined in their source files. The subscription programs accept connection flags and a password environment variable; their instructions describe server requirements, Pull/Push selection, ACK strategies, progress, and optional processors.

From the repository root, a subscription example can be selected as follows:

cd example
go run ./subscription/tree -host=127.0.0.1 -port=6667 -username=root

These programs are built by the root-module CI together with the client tests and E2E tests. CI does not execute the sample programs.