Skip to Content
How-To GuidesTypeScriptUsing Apache Ignite from a TypeScript Agent

Using Apache Ignite from a TypeScript Agent

The TypeScript SDK ships a typed Apache Ignite 2 helper built on the golem:rdbms/ignite2@1.5.0 host interface. Every operation returns a Promise and throws a typed IgniteError on failure.

Imports

import { Ignite } from "@golemcloud/golem-ts-sdk";
  • Ignite.open(url, options?) — open a connection.
  • Ignite.* — explicit rich-type parameter wrappers (Ignite.string, Ignite.int, Ignite.uuid, …).

Open a Connection

Ignite uses thin-client URLs like ignite://host:10800.

const conn = await Ignite.open("ignite://127.0.0.1:10800");

Query Data

Ignite placeholders use ?. Plain JS values are encoded automatically (string → db-string, integer → db-int/db-long, etc.); wrap a value in an Ignite.* helper to pin an exact type. Rows come back as decoded { columnName: value } records.

const result = await conn.query("SELECT ? AS message", ["hello"]); const message = result.rows[0]?.message as string;

Execute Statements

Include WITH "CACHE_NAME=..." when creating tables through Ignite SQL.

await conn.execute( `CREATE TABLE IF NOT EXISTS notes ( id INT PRIMARY KEY, body VARCHAR ) WITH "CACHE_NAME=notes"`, );

Transactions

Run a block inside a transaction — it commits on success and rolls back if the callback throws:

await conn.transaction(async (tx) => { tx.execute("INSERT INTO notes (id, body) VALUES (?, ?)", [1, "hello"]); });

Or drive it manually with begin() / commit() / rollback():

const tx = await conn.begin(); tx.execute("INSERT INTO notes (id, body) VALUES (?, ?)", [1, "hello"]); await tx.commit();