Add default returning record on db insert and update

This commit is contained in:
2026-10-17 18:44:26 +01:00
parent 695347944d
commit 07807cb19d
5 changed files with 73 additions and 9 deletions
+6 -1
View File
@@ -7,11 +7,16 @@ type Params<Schema extends {
table: Table;
data: Schema[];
update_on_duplicate?: boolean;
/**
* Append `RETURNING *` so the inserted record(s) come back in
* `payload`/`singleRes`. Defaults to `true`.
*/
returning?: boolean;
config?: BunSQLiteConfig;
};
export default function DbInsert<Schema extends {
[k: string]: any;
} = {
[k: string]: any;
}, Table extends string = string>({ table, data, update_on_duplicate, config, }: Params<Schema, Table>): Promise<APIResponseObject>;
}, Table extends string = string>({ table, data, update_on_duplicate, returning, config, }: Params<Schema, Table>): Promise<APIResponseObject<Schema>>;
export {};