25 lines
849 B
TypeScript
25 lines
849 B
TypeScript
import type { APIResponseObject, BunSQLiteConfig, ServerQueryParam } from "../../types";
|
|
type Params<Schema extends {
|
|
[k: string]: any;
|
|
} = {
|
|
[k: string]: any;
|
|
}, Table extends string = string> = {
|
|
table: Table;
|
|
data: Schema;
|
|
query?: ServerQueryParam<Schema>;
|
|
targetId?: number | string;
|
|
/**
|
|
* Append `RETURNING *` so the updated record(s) come back in
|
|
* `payload`/`singleRes`. Defaults to `true`. Ignored for vector tables,
|
|
* where SQLite does not support `UPDATE ... RETURNING`.
|
|
*/
|
|
returning?: boolean;
|
|
config?: BunSQLiteConfig;
|
|
};
|
|
export default function DbUpdate<Schema extends {
|
|
[k: string]: any;
|
|
} = {
|
|
[k: string]: any;
|
|
}, Table extends string = string>({ table, data, query, targetId, returning, config, }: Params<Schema, Table>): Promise<APIResponseObject<Schema>>;
|
|
export {};
|