Skip to content

How to Specify Database Settings #1001

@djamez

Description

@djamez

Hello

I stumbled upon this project and having used Eloquent, Knex, Kysely and Objection; and also bun's SQL;, I do think - from the documentation - that this presents a really nice DX that draws from the afore-mentioned libraries.

My attempt to test it has been unsuccessful. I cannot seem to be able to specify database settings.

I tried this:

config.dialect = 'mysql';
config.sql.randomFunction = 'RAND()';
config.sql.sharedLockSyntax = 'LOCK IN SHARE MODE';
config.sql.jsonContainsMode = 'function';

config.database.url = "mysql://root:password@localhost:3306/testdb";

...
const db = createQueryBuilder(...);

const ok = await db.ping()
await db.waitForReady({ attempts: 100, delayMs: 250 })

..yields "Database not ready after waiting".

Attempting to use the longer version:

config.database.host = 'localhost';
config.database.port = 3306;
config.database.username = 'root';
config.database.password = 'password';
config.database.database = 'testdb';

...yields the same error. The documentation does not mention this anywhere - or at least I could not find it. Not even in the examples.

Please advise.

PS: The documentation on the website (https://bun-query-builder.netlify.app) is lagging behind the repo quite significantly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions