/[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 344 by rakin, Mon Jul 29 17:29:40 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;
6          this.dbpath = dbpath;      dbpath: string;
         this.db = new DB(dbpath, (err) => {  
             if (err) {  
                 console.log(err);  
             }  
         });  
     }  
7    
8      get(sql, callback1, callback2) {      constructor(dbpath: string, client: DiscordClient) {
9          return this.db.get(sql, callback1, callback2);          this.client = client;
10      }          this.dbpath = dbpath;
11    
12      all(sql, callback1, callback2) {          mongoose.connect(process.env.MONGO_URI!)
13          return this.db.all(sql, callback1, callback2);              .then(() => console.log("Connected to MongoDB"))
14                .catch(console.error);
15      }      }
 }  
   
 module.exports = Database;  
16    }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26