node-gamedig/lib/index.js

24 lines
491 B
JavaScript
Raw Normal View History

const QueryRunner = require('./QueryRunner');
2014-10-29 08:02:03 +01:00
2019-01-12 11:43:36 +01:00
let singleton = null;
2014-10-29 08:02:03 +01:00
class Gamedig {
2019-01-12 11:43:36 +01:00
constructor() {
this.queryRunner = new QueryRunner();
2019-01-12 11:43:36 +01:00
}
2017-03-14 09:40:02 +01:00
2019-01-12 11:43:36 +01:00
async query(userOptions) {
return await this.queryRunner.run(userOptions);
}
2014-10-29 08:02:03 +01:00
2019-01-12 11:43:36 +01:00
static getInstance() {
if (!singleton) singleton = new Gamedig();
2019-01-12 11:43:36 +01:00
return singleton;
}
static async query(...args) {
return await Gamedig.getInstance().query(...args);
2017-08-09 12:32:09 +02:00
}
}
2014-10-29 08:02:03 +01:00
module.exports = Gamedig;