i am kinda new to this node js and sqlite thing but i have create a simple function to get 1 results from my sqlite db
getOne: function() {
sql.get(`SELECT * FROM currency_list order by rowid desc limit 1`).then(row => {
if (!row) {
return console.log("no data");
} else {
return row;
}
});
},
and then my caller something like this
module.exports = {
run : (args, Client, msg, isOwner) => {
let results = db.getOne();
console.log("test result =>"+JSON.stringify(results));
}
};
i dont get any results as my console log will show Undefined from the function. Can i know how to make the function return values?