import { Kysely, UpdateQueryBuilder, UpdateResult, Updateable } from 'kysely'; import { SelectionColumn } from '../lib/type-utils.js'; import { CountTransform, UpdateTransforms } from '../mappers/table-mapper-transforms.js'; /** * Mapping query for updating rows from a database table. */ export declare class MappingUpdateQuery, UpdatingObject, UpdateReturnColumns extends Readonly[]> | ['*'], ReturnCount, UpdateReturn> { #private; readonly db: Kysely; readonly qb: QB; protected readonly transforms: Readonly & UpdateTransforms>; protected readonly returnColumns: Readonly; constructor(db: Kysely, qb: QB, transforms: Readonly & UpdateTransforms>, returnColumns: Readonly); /** * Modifies the underlying Kysely query builder. * @param factory A function that takes the current query builder and * returns a new query builder. */ modify>(factory: (qb: QB) => NextQB): MappingUpdateQuery; /** * Runs the query, returning the number of rows updated, in * the required client representation. * @param obj The object which which to update the rows. * @returns Number of rows updated, in client-requested representation. */ returnCount(obj: UpdatingObject): Promise; /** * Updates rows with the values that result from transforming the object via * `updateTransform` (if defined). For each row updated, retrieves the * columns specified in `returnColumns` (if defined), returning them to the * caller as an `UpdateReturn`, after transformation by any provided * `updateReturnTransform`. If `returnColumns` is empty, returns `undefined`. * @returns If `returnColumns` is not empty, returns an array containing one * object for each row updated; otherwise returns `undefined`. */ returnAll(obj: UpdatingObject): Promise; /** * Updates rows with the values that result from transforming the object via * `updateTransform` (if defined). For the first row updated, retrieves the * columns specified in `returnColumns` (if defined), returning them to the * caller as an `UpdateReturn`, after transformation by any provided * `updateReturnTransform`. If `returnColumns` is empty, returns `undefined`. * @returns If `returnColumns` is empty, returns `undefined`. Otherwise, * returns the first object if at least one row was updated, or `null` if * no rows were updated. */ returnOne(obj: UpdatingObject): Promise; /** * Runs the query, updating rows, without returning any columns. * @param obj The object which which to update the rows. * @returns `true` if any rows were updated, `false` otherwise. */ run(obj: UpdatingObject): Promise; /** * Returns an array of the columns to be updated, with * `['*']` indicating that all columns will be updated. * @returns An array of the columns to be updated. */ protected getUpdateColumns(): Readonly<(keyof Updateable & string)[]> | ['*']; /** * Returns a query builder for updating rows in the table and * returning values, caching the query builder for future use. * @returns A query builder for updating rows in the table and * returning values. */ protected getReturningQB(): UpdateQueryBuilder; /** * Loads the object with which to update rows. * @param qb The query builder to load the objects into. * @param obj The object with which to update rows. * @returns The query builder with the object loaded. */ protected loadUpdatingObject(qb: UpdateQueryBuilder, obj: UpdatingObject): UpdateQueryBuilder; /** * Sets the values of the updated columns. * @param qb The query builder to set the values into. * @param obj The object of column-value pairs to be updated. */ protected setColumnValues(qb: UpdateQueryBuilder, obj: Updateable): UpdateQueryBuilder; } //# sourceMappingURL=update-query.d.ts.map