Interface ReturningInterface<DB, TB, O>
interface ReturningInterface<DB, TB, O> { returning<SE>(selections): ReturningInterface<DB, TB, ReturningRow<DB, TB, O, SE>>; returning<CB>(callback): ReturningInterface<DB, TB, ReturningCallbackRow<DB, TB, O, CB>>; returning<SE>(selection): ReturningInterface<DB, TB, ReturningRow<DB, TB, O, SE>>; returningAll(): ReturningInterface<DB, TB, Selectable<DB[TB]>>; } Methods
returning
- returning<SE>(selections): ReturningInterface<DB, TB, ReturningRow<DB, TB, O, SE>>
Type Parameters
- SE extends string | DynamicReferenceBuilder<any> | AliasedExpression<any, any> | AliasedExpressionFactory<DB, TB>
Parameters
- selections: readonly SE[]
- returning<CB>(callback): ReturningInterface<DB, TB, ReturningCallbackRow<DB, TB, O, CB>>
- returning<SE>(selection): ReturningInterface<DB, TB, ReturningRow<DB, TB, O, SE>>
Type Parameters
- SE extends string | DynamicReferenceBuilder<any> | AliasedExpression<any, any> | AliasedExpressionFactory<DB, TB>
returningAll
- returningAll(): ReturningInterface<DB, TB, Selectable<DB[TB]>>
Allows you to return data from modified rows.
On supported databases like PostgreSQL, this method can be chained to
insert,updateanddeletequeries to return data.Note that on SQLite you need to give aliases for the expressions to avoid this bug in SQLite. For example
.returning('id as id').Also see the returningAll method.
Examples
Return one column:
Return multiple columns:
Return arbitrary expressions: