allow to override default database config in new
this way we can temporarily allow to execute multiple statements in one query.
This commit is contained in:
parent
0705ed9018
commit
bbe0c91d7e
1 changed files with 4 additions and 2 deletions
|
@ -11,7 +11,9 @@ const connectionOptions: mysql.ConnectionOptions = {
|
|||
};
|
||||
|
||||
export const database =
|
||||
await mysql.createConnection(connectionOptions) as Connection & { new: () => Promise<Connection> };
|
||||
database.new = () => { return mysql.createConnection(connectionOptions); };
|
||||
await mysql.createConnection(connectionOptions) as Connection & {
|
||||
new: (localConnectionOptions: mysql.ConnectionOptions | undefined) => Promise<Connection>
|
||||
};
|
||||
database.new = (localConnectionOptions: mysql.ConnectionOptions | undefined) => { return mysql.createConnection({ ...localConnectionOptions, ...connectionOptions }); };
|
||||
|
||||
export type data<T> = [T[], mysql.FieldPacket[]];
|
||||
|
|
Loading…
Reference in a new issue