<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Node-DuckDB API](./node-duckdb.md)

## Node-DuckDB API

Node-DuckDB is a thin wrapper on top of [DuckDB](https://duckdb.org/)<!-- -->.

Using it involves:

1. Creating a [DuckDB](./node-duckdb.duckdb.md) object

2. Creating a [Connection](./node-duckdb.connection.md) object to the DuckDB object

3. Calling [Connection.execute](./node-duckdb.connection.execute.md) or [Connection.executeIterator](./node-duckdb.connection.executeiterator.md) on the Connection object

## Example

Do some simple querying and print the result

```ts
import { Connection, DuckDB } from "node-duckdb";

async function queryDatabaseWithIterator() {
  // create new database in memory
  const db = new DuckDB();
  // create a new connection to the database
  const connection = new Connection(db);

  // perform some queries
  await connection.executeIterator("CREATE TABLE people(id INTEGER, name VARCHAR);");
  await connection.executeIterator("INSERT INTO people VALUES (1, 'Mark'), (2, 'Hannes'), (3, 'Bob');");
  const result = await connection.executeIterator("SELECT * FROM people;");

  // fetch and print result
  console.log(result.fetchAllRows());

  // release resources
  connection.close();
  db.close();
}

queryDatabaseWithIterator();
```

For more examples see [here](https://github.com/deepcrawl/node-duckdb/tree/feature/ODIN-423-welcome-page/examples)<!-- -->.

## Classes

| Class                                             | Description                                                                                                                                                                                |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Connection](./node-duckdb.connection.md)         | Represents a DuckDB connection.                                                                                                                                                            |
| [DuckDB](./node-duckdb.duckdb.md)                 | The DuckDB class represents a DuckDB database instance.                                                                                                                                    |
| [ResultIterator](./node-duckdb.resultiterator.md) | ResultIterator represents the result set of a DuckDB query. Instances of this class are returned by the [Connection.executeIterator](./node-duckdb.connection.executeiterator.md)<!-- -->. |

## Enumerations

| Enumeration                                         | Description                                          |
| --------------------------------------------------- | ---------------------------------------------------- |
| [AccessMode](./node-duckdb.accessmode.md)           | Access mode specifier                                |
| [OrderByNullType](./node-duckdb.orderbynulltype.md) | Null order specifier                                 |
| [OrderType](./node-duckdb.ordertype.md)             | Default sort order specifier                         |
| [ResultType](./node-duckdb.resulttype.md)           | Specifier for how DuckDB attempts to load the result |
| [RowResultFormat](./node-duckdb.rowresultformat.md) | Result format specifier for rows                     |

## Interfaces

| Interface                                                     | Description                              |
| ------------------------------------------------------------- | ---------------------------------------- |
| [IDuckDBConfig](./node-duckdb.iduckdbconfig.md)               | Configuration object for DuckDB          |
| [IDuckDBOptionsConfig](./node-duckdb.iduckdboptionsconfig.md) | Options object type for the DuckDB class |
| [IExecuteOptions](./node-duckdb.iexecuteoptions.md)           | Options for connection.execute           |
