BulkInsert
Flavio Lionel Rita edited this page Aug 15, 2022
·
1 revision
Lambda
Categories.bulkInsert()
SQL
INSERT INTO Categories(CategoryName,Description) VALUES ?
Lambda
Orders.bulkInsert().include(p => p.details)
SQL
INSERT INTO Orders(CustomerID,EmployeeID,OrderDate,RequiredDate,ShippedDate,ShipVia,Freight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,ShipCountry) VALUES ?
INSERT INTO `Order Details`(OrderID,ProductID,UnitPrice,Quantity,Discount) VALUES ?
Lambda
import { orm } from 'lambdaorm'
async function example () {
await orm.init()
const categories = [
{
name: 'Beverages4',
description: 'Soft drinks, coffees, teas, beers, and ales',
id: 12
},
{
name: 'Condiments4',
description: 'Sweet and savory sauces, relishes, spreads, and seasonings',
id: 13
}
]
const insert = () => Categories.bulkInsert()
const result = await orm.lambda(insert).execute('MySQL',categories)
console.log(JSON.stringify(result, null, 2))
await orm.end()
}
- Home
- Features
- Concepts
- Schema
- Queries
- Operators & Functions
- Use
- Related Projects
- Labs
- Source Code Documentation
- Change log