wrappers/tests/testMaria.js

33 lines
830 B
JavaScript
Raw Normal View History

process.env.NODE_ENV = 'development';
2023-05-02 23:59:06 +02:00
import { readFileSync } from 'fs';
import { MariaDB } from '../build/esm/index.js';
const credentials = JSON.parse(readFileSync('../credentials.json', { encoding: 'utf-8' }));
2023-05-02 23:59:06 +02:00
const maria = new MariaDB({
createLogger: () =>
2023-07-03 15:33:39 +02:00
{
2023-05-02 23:59:06 +02:00
return {
debug: console.log,
info: console.log,
2023-05-02 23:59:06 +02:00
status: console.log,
warn: console.log,
error: console.error
2023-05-02 23:59:06 +02:00
};
}
}, {
load: true,
credentials,
cluster: {
canRetry: true,
removeNodeErrorCount: 5,
restoreNodeTimeout: 60000,
defaultSelector: 'RR'
}
2023-05-02 23:59:06 +02:00
});
await maria.init();
// await maria.query('INSERT INTO `test` (`dingle`, `bingle`) VALUES ?', [[ 1, 2 ], [ 3, 4 ], [ 5, 6 ]]);
2023-05-02 23:59:06 +02:00
await maria.close();