insert-sql
v1.0.2
Published
help developer generator a insert SQL statement
Downloads
6
Readme
insert-sql
help developer generator a insert SQL statement
install
npm i insert-sql
example
import { getInsertSql } from "insert-sql";
getInsertSql("tb_user", ["id", "name", "age"])
// "INSERT INTO `tb_user` (`id`, `name`, `age`) VALUES (:id, :name, :age)"
getInsertSql("tb_user", ["id", "name", "age"], '?')
// "INSERT INTO `tb_user` (`id`, `name`, `age`) VALUES (?, ?, ?)"
define
/**
* get insert sql
* @param {String} table
* @param {Array} fields
* @param {String} placeholder
* @returns
*/
function getInsertSql(table, fields, placeholder = null)
test
# use test
$ npm run test