diff --git a/package.json b/package.json index bd1063d..467100d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.3.8", + "version": "1.3.9", "description": "Cloud-based SQL data management tool", "main": "index.js", "scripts": { diff --git a/utils/get.js b/utils/get.js index 4b4810c..0f7cc75 100644 --- a/utils/get.js +++ b/utils/get.js @@ -28,10 +28,11 @@ const https = require("https"); * @param {string} params.db - Database Name * @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 * * @returns { Promise } - Return Object */ -async function get({ key, db, query, queryValues }) { +async function get({ key, db, query, queryValues, tableName }) { /** * Make https request * @@ -44,7 +45,7 @@ async function get({ key, db, query, queryValues }) { .replace(/ /g, "+")}`; if (queryValues) { - path += `&queryValues=${JSON.stringify(queryValues)}`; + path += `&queryValues=${JSON.stringify(queryValues)}${tableName ? `&tableName=${tableName}` : ""}}`; } https diff --git a/utils/post.js b/utils/post.js index 28b5d80..0fafb90 100644 --- a/utils/post.js +++ b/utils/post.js @@ -1,3 +1,5 @@ +// @ts-check + /** * Imports */ @@ -42,10 +44,11 @@ const https = require("https"); * @param {string} params.database - Database Name * @param {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 * * @returns { Promise } - Return Object */ -async function post({ key, query, queryValues, database }) { +async function post({ key, query, queryValues, database, tableName }) { /** * Make https request * @@ -56,6 +59,7 @@ async function post({ key, query, queryValues, database }) { query, queryValues, database, + tableName, }).replace(/\n|\r|\n\r/gm, ""); try {