1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

Improvements to query builder

This commit is contained in:
2020-06-15 18:23:51 +02:00
parent aa7618ec8d
commit 6f03e66ef2
12 changed files with 200 additions and 68 deletions

View File

@ -1,7 +1,16 @@
'use strict';
export default class {
static async raw (connection, query, database) {
if (database) await connection.raw(`USE \`${database}\``);
static async raw (connection, query, schema) {
if (schema) await connection.raw(`USE \`${schema}\``);
return connection.raw(query);
}
static async getTableData (connection, schema, table) {
return connection
.select('*')
.schema(schema)
.from(table)
.limit(1000)
.run();
}
}