@onurege3467/zerohelper
Version:
ZeroHelper is a versatile JavaScript library offering helper functions and database utilities for developers. It supports MongoDB, MySQL, SQLite, Redis, and PostgreSQL.
14 lines (10 loc) • 406 B
JavaScript
;
const errors = require("../errors/strings.js");
module.exports = async function (table = "default") {
if (!table || typeof table !== "string")
throw new TypeError(errors.table.replace("{received}", typeof table));
let res = await this.query(
`SHOW TABLE STATUS FROM ${this.db.pool.config.connectionConfig.database} WHERE name LIKE '${table}';`
);
return res[0] || null;
};