Discord_API_Bot/helpers/helper.js
2024-04-08 04:12:41 -06:00

33 lines
No EOL
675 B
JavaScript

module.exports = {
query: async function (db, sql) {
return new Promise((resolve, reject) => {
db.query(sql, async (error, results) => {
if (error) {
throw error;
}
if (results.length > 0) {
resolve(results[0]);
} else {
resolve(false);
}
});
});
},
queryMulti: async function (db, sql) {
return new Promise((resolve, reject) => {
db.query(sql, async (error, results) => {
if (error) {
throw error;
}
if (results.length > 0) {
resolve(results);
} else {
resolve(false);
}
});
});
}
};