mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
WIP: Rewrite to TS & Cleanup
This commit is contained in:
27 files changed
+508
-504
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { createPool, QueryError } from 'mysql2/promise';
|
||||
import { connectionOptions, mysql_transaction_isolation_level } from '../config';
|
||||
import { typeCast } from '../utils/typeCast';
|
||||
|
||||
const pool = createPool({
|
||||
connectTimeout: 60000,
|
||||
...connectionOptions,
|
||||
typeCast,
|
||||
});
|
||||
|
||||
pool
|
||||
.query(mysql_transaction_isolation_level)
|
||||
.then(() => console.log(`^2Database server connection established!^0`))
|
||||
.catch((e: QueryError) =>
|
||||
setInterval(() => console.error(`^3Unable to establish a connection to the database! [${e.code}]\n${e.message}^0`), 5000)
|
||||
);
|
||||
|
||||
export { pool };
|
||||
Reference in new issue
Block a user