Module: TableInsert

TableInsert factory.
Mixes In:

Methods


execute()

Execute the insert query.
Returns:
Type
Promise.<module:Result>

<inner> module:TableInsert:values(ExprOrLiteral)

Set row values.
Parameters:
Name Type Description
ExprOrLiteral string | Array.<string> column values
Throws:
When there is a mismatch with the number columns in the query.
Type
Error
Returns:
The query instance
Type
module:TableInsert
Example
// arguments as column values
table.insert('foo', 'bar').values('baz', 'qux')
table.insert(['foo', 'bar']).values('baz', 'qux')

// array of column values
table.insert('foo', 'bar').values(['baz', 'qux'])
table.insert(['foo', 'bar']).values(['baz', 'qux'])

// comma-separated string with column values
table.insert('foo', 'bar').values('baz, qux'])
table.insert(['foo', 'bar']).values('baz, qux')

// chaining multiple inserts
table.insert('foo', 'bar')
     .values(['baz', 'qux'])
     .values(['quux', 'biz'])
     .values('foo, bar')