/[sudobot]/trunk/src/client/Database.ts
ViewVC logotype

Diff of /trunk/src/client/Database.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/src/Database.js revision 5 by rakin, Mon Jul 29 17:28:11 2024 UTC trunk/src/client/Database.ts revision 346 by rakin, Mon Jul 29 17:29:42 2024 UTC
# Line 1  Line 1 
1  const { Database: DB } = require('sqlite3');  import DiscordClient from './Client';
2    import mongoose from "mongoose";
3    
4  class Database {  export default class Database {
5      constructor(dbpath) {      client: DiscordClient;
         this.dbpath = dbpath;  
         this.db = new DB(dbpath, (err) => {  
             if (err) {  
                 console.log(err);  
             }  
         });  
     }  
6    
7      get(sql, callback1, callback2) {      constructor(client: DiscordClient) {
8          return this.db.get(sql, callback1, callback2);          this.client = client;
     }  
9    
10      all(sql, callback1, callback2) {          mongoose.connect(process.env.MONGO_URI!)
11          return this.db.all(sql, callback1, callback2);              .then(() => console.log("Connected to MongoDB"))
12                .catch(console.error);
13      }      }
 }  
   
 module.exports = Database;  
14    }

Legend:
Removed from v.5  
changed lines
  Added in v.346

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26