Add Insert Generator

This commit is contained in:
Benjamin Toby 2024-11-12 12:01:39 +01:00
parent f5e89799fc
commit a01dd7107b
4 changed files with 29 additions and 1 deletions

24
functions/sql/sql-insert-generator.d.ts vendored Normal file
View File

@ -0,0 +1,24 @@
export = sqlInsertGenerator;
/**
* @typedef {object} SQLINsertGenReturn
* @property {string} query
* @property {string[]} values
*/
/**
* @param {object} param0
* @param {any[]} param0.data
* @param {string} param0.tableName
*
* @return {SQLINsertGenReturn | undefined}
*/
declare function sqlInsertGenerator({ tableName, data }: {
data: any[];
tableName: string;
}): SQLINsertGenReturn | undefined;
declare namespace sqlInsertGenerator {
export { SQLINsertGenReturn };
}
type SQLINsertGenReturn = {
query: string;
values: string[];
};

2
index.d.ts vendored
View File

@ -26,6 +26,7 @@ import sanitizeSql = require("./utils/functions/sanitizeSql");
import datasquirelClient = require("./client"); import datasquirelClient = require("./client");
export namespace sql { export namespace sql {
export { sqlGenerator }; export { sqlGenerator };
export { sqlInsertGenerator };
} }
import uploadImage = require("./utils/upload-image"); import uploadImage = require("./utils/upload-image");
import uploadFile = require("./utils/upload-file"); import uploadFile = require("./utils/upload-file");
@ -43,4 +44,5 @@ import validateToken = require("./users/validate-token");
import loginWithGoogle = require("./users/social/google-auth"); import loginWithGoogle = require("./users/social/google-auth");
import loginWithGithub = require("./users/social/github-auth"); import loginWithGithub = require("./users/social/github-auth");
import sqlGenerator = require("./functions/sql/sql-generator"); import sqlGenerator = require("./functions/sql/sql-generator");
import sqlInsertGenerator = require("./functions/sql/sql-insert-generator");
export { get, post, getSchema, sanitizeSql, datasquirelClient as client }; export { get, post, getSchema, sanitizeSql, datasquirelClient as client };

View File

@ -29,6 +29,7 @@ const validateToken = require("./users/validate-token");
const sanitizeSql = require("./utils/functions/sanitizeSql"); const sanitizeSql = require("./utils/functions/sanitizeSql");
const datasquirelClient = require("./client"); const datasquirelClient = require("./client");
const sqlGenerator = require("./functions/sql/sql-generator"); const sqlGenerator = require("./functions/sql/sql-generator");
const sqlInsertGenerator = require("./functions/sql/sql-insert-generator");
//////////////////////////////////////// ////////////////////////////////////////
//////////////////////////////////////// ////////////////////////////////////////
@ -68,6 +69,7 @@ const media = {
*/ */
const sql = { const sql = {
sqlGenerator, sqlGenerator,
sqlInsertGenerator,
}; };
/** /**

View File

@ -1,6 +1,6 @@
{ {
"name": "@moduletrace/datasquirel", "name": "@moduletrace/datasquirel",
"version": "2.5.9", "version": "2.6.0",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {