Initial commit - Event Planner application
This commit is contained in:
53
node_modules/kysely/dist/esm/dialect/mysql/mysql-dialect.js
generated
vendored
Normal file
53
node_modules/kysely/dist/esm/dialect/mysql/mysql-dialect.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/// <reference types="./mysql-dialect.d.ts" />
|
||||
import { MysqlDriver } from './mysql-driver.js';
|
||||
import { MysqlQueryCompiler } from './mysql-query-compiler.js';
|
||||
import { MysqlIntrospector } from './mysql-introspector.js';
|
||||
import { MysqlAdapter } from './mysql-adapter.js';
|
||||
/**
|
||||
* MySQL dialect that uses the [mysql2](https://github.com/sidorares/node-mysql2#readme) library.
|
||||
*
|
||||
* The constructor takes an instance of {@link MysqlDialectConfig}.
|
||||
*
|
||||
* ```ts
|
||||
* import { createPool } from 'mysql2'
|
||||
*
|
||||
* new MysqlDialect({
|
||||
* pool: createPool({
|
||||
* database: 'some_db',
|
||||
* host: 'localhost',
|
||||
* })
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* If you want the pool to only be created once it's first used, `pool`
|
||||
* can be a function:
|
||||
*
|
||||
* ```ts
|
||||
* import { createPool } from 'mysql2'
|
||||
*
|
||||
* new MysqlDialect({
|
||||
* pool: async () => createPool({
|
||||
* database: 'some_db',
|
||||
* host: 'localhost',
|
||||
* })
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
export class MysqlDialect {
|
||||
#config;
|
||||
constructor(config) {
|
||||
this.#config = config;
|
||||
}
|
||||
createDriver() {
|
||||
return new MysqlDriver(this.#config);
|
||||
}
|
||||
createQueryCompiler() {
|
||||
return new MysqlQueryCompiler();
|
||||
}
|
||||
createAdapter() {
|
||||
return new MysqlAdapter();
|
||||
}
|
||||
createIntrospector(db) {
|
||||
return new MysqlIntrospector(db);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user