new functions to get number of rows in db
This commit is contained in:
parent
84036ecbb5
commit
7acf3301ad
1 changed files with 15 additions and 0 deletions
|
@ -161,6 +161,21 @@ class Database {
|
||||||
const res = await this.pool.query('INSERT INTO users (user_id) VALUES ($1) RETURNING *;', [id]);
|
const res = await this.pool.query('INSERT INTO users (user_id) VALUES ($1) RETURNING *;', [id]);
|
||||||
return res.rows[0];
|
return res.rows[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async countGuilds () {
|
||||||
|
const res = await this.pool.query('SELECT COUNT(*) FROM guilds;');
|
||||||
|
return res.rows[0].count;
|
||||||
|
}
|
||||||
|
|
||||||
|
async countMembers () {
|
||||||
|
const res = await this.pool.query('SELECT COUNT(*) FROM members;');
|
||||||
|
return res.rows[0].count;
|
||||||
|
}
|
||||||
|
|
||||||
|
async countUsers () {
|
||||||
|
const res = await this.pool.query('SELECT COUNT(*) FROM users;');
|
||||||
|
return res.rows[0].count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Database;
|
module.exports = Database;
|
Loading…
Reference in a new issue