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.
| Example | Command from this directory |
|---|---|
| Tree Session | go run . |
| Table Session | go run ./table |
| Tree Session pool | go run ./session_pool |
| Table Session pool | go run ./session_pool/table |
| database/sql | go run ./database_sql |
| Tree record subscriptions | go run ./subscription/tree |
| Table record subscriptions | go run ./subscription/table |
| Tree incremental subscriptions | go run ./subscription/tree/incremental |
| Table incremental subscriptions | go 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.