From 17c41375b3a9be81ccb382d595b92407a8f8acf9 Mon Sep 17 00:00:00 2001 From: charlottecooke <36961462+charlottecooke@users.noreply.github.com> Date: Fri, 14 Feb 2020 14:10:59 +0000 Subject: [PATCH] Update to the description of db.insert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I have found when trying to use the insert method that the description given here didn't quite match up with how it is actually implemented so I have edited the description a little and added an example. Feel free to keep or not keep this change 👍 --- docs/API/SQL.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/API/SQL.md b/docs/API/SQL.md index dad7024..0872401 100644 --- a/docs/API/SQL.md +++ b/docs/API/SQL.md @@ -262,16 +262,26 @@ exports.down = function (db, callback) }; ``` -### insert(tableName, columnNameArray, valueArray, callback) +### insert(tableName, { columnName: value }, callback) Insert an item into a given column __Arguments__ * tableName - table to insert the item into -* columnNameArray - the array existing column names for each item being inserted -* valueArray - the array of values to be inserted into the associated column -* callback(err) - callback that will be invoked once the insert has been completed. +* columnName - the column name for each item being inserted +* value - the array of values to be inserted into the associated column +* callback - callback that will be invoked once the insert has been completed. + +```javascript +exports.up = function(db, callback) +{ + db.insert('tableName', + { + columnName: 'value', columnName2: 'value2' + }, callback); +}; +``` ### removeIndex([tableName], indexName, callback)