wrappers/tests/testMaria.js

33 lines
803 B
JavaScript

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