diff --git a/src/duckdb-async.ts b/src/duckdb-async.ts index 45aec96..0ceefae 100644 --- a/src/duckdb-async.ts +++ b/src/duckdb-async.ts @@ -45,6 +45,10 @@ const connAllAsync = methodPromisify( duckdb.Connection.prototype.all ); +const connCloseAsync = methodPromisify( + duckdb.Connection.prototype.close +); + const connArrowIPCAll = methodPromisify( duckdb.Connection.prototype.arrowIPCAll ); @@ -100,6 +104,15 @@ export class Connection { }); } + async close(): Promise { + if (!this.conn) { + throw new Error("Connection.close: uninitialized connection"); + } + await connCloseAsync(this.conn); + this.conn = null; + return; + } + async all(sql: string, ...args: any[]): Promise { if (!this.conn) { throw new Error("Connection.all: uninitialized connection");