duckdb-node icon indicating copy to clipboard operation
duckdb-node copied to clipboard

Incorrect Description of Database Configuration

Open judgeNotFound opened this issue 1 year ago • 0 comments

On the website for the DuckDB-Node client, the following is the way to configure the database:

const db = new duckdb.Database(':memory:', {
    "access_mode": "READ_WRITE",
    "max_memory": "512MB",
    "threads": "4"
}, (err) => {
  if (err) {
    console.error(err);
  }
});

However, running this results in:

src/store.controller.ts:25:55 - error TS2322: Type 'number' is not assignable to type 'string'

25       { access_mode: "READ_WRITE", max_memory: "8GB", threads: 4 },
                                                         ~~~~~~~

Which is totally not surprising looking at what goes on in the Database constructor:

export class Database {
  constructor(path: string, accessMode?: number | Record<string,string>, callback?: Callback<any>);
  constructor(path: string, callback?: Callback<any>);

 ...

It does not hold any possibility to hand over the described configuration parameters.

judgeNotFound avatar Jun 03 '24 13:06 judgeNotFound