Updates
This commit is contained in:
+4
-2
@@ -19,10 +19,11 @@ const grabHostNames = require("../package-shared/utils/grab-host-names");
|
||||
* @param {string} params.query - SQL Query
|
||||
* @param {string[]} [params.queryValues] - An array of query values if using "?" placeholders
|
||||
* @param {string} [params.tableName] - Name of the table to query
|
||||
* @param {boolean} [params.useLocal] - Whether to use a remote database instead of API
|
||||
*
|
||||
* @returns { Promise<import("../package-shared/types").GetReturn> } - Return Object
|
||||
*/
|
||||
async function get({ key, db, query, queryValues, tableName }) {
|
||||
async function get({ key, db, query, queryValues, tableName, useLocal }) {
|
||||
const { host, port, scheme } = grabHostNames();
|
||||
|
||||
/**
|
||||
@@ -37,7 +38,8 @@ async function get({ key, db, query, queryValues, tableName }) {
|
||||
DSQL_DB_HOST?.match(/./) &&
|
||||
DSQL_DB_USERNAME?.match(/./) &&
|
||||
DSQL_DB_PASSWORD?.match(/./) &&
|
||||
DSQL_DB_NAME?.match(/./)
|
||||
DSQL_DB_NAME?.match(/./) &&
|
||||
useLocal
|
||||
) {
|
||||
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
|
||||
let dbSchema;
|
||||
|
||||
+11
-4
@@ -1,7 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
const http = require("http");
|
||||
const https = require("https");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const localPost = require("../engine/query/post");
|
||||
@@ -17,10 +15,18 @@ const grabHostNames = require("../package-shared/utils/grab-host-names");
|
||||
* @param {import("../package-shared/types").PostDataPayload | string} params.query - SQL query String or Request Object
|
||||
* @param {any[]} [params.queryValues] - Query Values if using "?" placeholders
|
||||
* @param {string} [params.tableName] - Name of the table to query
|
||||
* @param {boolean} [params.useLocal] - Whether to use a remote database instead of API
|
||||
*
|
||||
* @returns { Promise<import("../package-shared/types").PostReturn> } - Return Object
|
||||
*/
|
||||
async function post({ key, query, queryValues, database, tableName }) {
|
||||
async function post({
|
||||
key,
|
||||
query,
|
||||
queryValues,
|
||||
database,
|
||||
tableName,
|
||||
useLocal,
|
||||
}) {
|
||||
const { host, port, scheme } = grabHostNames();
|
||||
|
||||
/**
|
||||
@@ -35,7 +41,8 @@ async function post({ key, query, queryValues, database, tableName }) {
|
||||
DSQL_DB_HOST?.match(/./) &&
|
||||
DSQL_DB_USERNAME?.match(/./) &&
|
||||
DSQL_DB_PASSWORD?.match(/./) &&
|
||||
DSQL_DB_NAME?.match(/./)
|
||||
DSQL_DB_NAME?.match(/./) &&
|
||||
useLocal
|
||||
) {
|
||||
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
|
||||
let dbSchema;
|
||||
|
||||
Reference in New Issue
Block a user