/[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 342 by rakin, Mon Jul 29 17:29:39 2024 UTC
# Line 1  Line 1 
1  const { Database: DB } = require('sqlite3');  import { Sequelize } from 'sequelize';
2    import { Database as DB } from 'sqlite3';
3    import DiscordClient from './Client';
4    import mongoose from "mongoose";
5    
6  class Database {  export default class Database {
7      constructor(dbpath) {      client: DiscordClient;
8          this.dbpath = dbpath;      dbpath: string;
         this.db = new DB(dbpath, (err) => {  
             if (err) {  
                 console.log(err);  
             }  
         });  
     }  
9    
10      get(sql, callback1, callback2) {      constructor(dbpath: string, client: DiscordClient) {
11          return this.db.get(sql, callback1, callback2);          this.client = client;
12      }          this.dbpath = dbpath;
13    
14      all(sql, callback1, callback2) {          mongoose.connect(process.env.MONGO_URI!)
15          return this.db.all(sql, callback1, callback2);              .then(() => console.log("Connected to MongoDB"))
16                .catch(console.error);
17      }      }
 }  
   
 module.exports = Database;  
18    }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26