Insert builds INSERT queries.
import Insert from '@stackpress/inquire/Insert';Most code uses it through engine.insert(table).
await engine.insert('users').values([
{ email: 'ada@example.com', name: 'Ada' },
{ email: 'grace@example.com', name: 'Grace' }
]);Set the rows to insert.
| Parameter | Type |
|---|---|
values |
Record<string, Value> | Record<string, Value>[] |
Request returned columns where the dialect supports it.
const rows = await engine.insert('users')
.values({ email: 'ada@example.com' })
.returning(['id', 'email']);Return the internal insert state.
Return one QueryObject.
Execute the query through the attached engine.
When awaited, Insert<R> resolves to R[].
For drivers without RETURNING, you will often get an empty array and inspect connection.lastId instead.