Advertisement
artursn

Untitled

Aug 5th, 2020
1,205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // TODO
  2. var db = new class Database{
  3.     connection = null;
  4.     constructor(){
  5.         this.connection = mysql.createConnection(config.mysql).promise();
  6.     }
  7.     getSelect(table,id){
  8.         var where  = "WHERE";
  9.         switch (table){
  10.             case listdb.User:
  11.                 where = 'id = ?'
  12.         }
  13.         return  this.connection.query("SELECT * FROM "+table+where,[id]).then(result =>{
  14.            return result;
  15.         });
  16.     }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement