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 |
|
} |