@dazejs/framework
Version:
Daze.js - A powerful web framework for Node.js
39 lines • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MysqlActuator = void 0;
const actuator_1 = require("./actuator");
class MysqlActuator extends actuator_1.Actuator {
constructor(pool) {
super();
this.pool = pool;
}
query(query, bindings = []) {
return new Promise((resolve, reject) => {
this.pool.query(query, bindings, (err, results) => {
if (err)
return reject(err);
resolve(results);
});
});
}
async select(query, bindings = []) {
return this.query(query, bindings);
}
async insert(query, bindings = []) {
return this.query(query, bindings).then((result) => result.insertId);
}
async update(query, bindings = []) {
return this.query(query, bindings).then((result) => result.affectedRows);
}
async delete(query, bindings = []) {
return this.query(query, bindings).then((result) => result.affectedRows);
}
async commit() {
throw new Error('You must open the transaction before you can use it');
}
async rollback() {
throw new Error('You must open the transaction before you can use it');
}
}
exports.MysqlActuator = MysqlActuator;
//# sourceMappingURL=mysql-actuator.js.map