mysql-all-in-one
Version:
A package that allows you to have a complete interaction with a MYSQL database, allowing to connect to the database, retrieve data and create queries.
14 lines (13 loc) • 622 B
TypeScript
import { PreparedStatement } from '../types';
import { InsertOptions, InsertRows } from './types';
/**
*
* @param table Table to insert
* @param rows An array of Objects or a single object (keys are the column names)
* @param opts Extra insert options like `ignore`
* @returns INSERT INTO SQL Query
* @example insert('table', [{id:1, name: "John"}, {id:2, name: "Anne"}], {ignore:true});
* >>> "INSERT IGNORE INTO `table` (`id`,`name`) VALUES (1,'John'),(2,'Anne');"
*/
declare const insert: (table: string, rows: InsertRows, opts?: InsertOptions | undefined) => PreparedStatement | string;
export default insert;