UNPKG

kysely-mapper

Version:

Flexible Kysely-based utility for mapping between tables and objects

38 lines 2.02 kB
import { DeleteQueryBuilder, Kysely } from 'kysely'; import { type ParametersObject } from 'kysely-params'; import { CountTransform } from '../mappers/table-mapper-transforms.js'; import { ParameterizableMappingQuery } from './parameterizable-query.js'; /** * Compiling mapping query for deleting rows from a database table. */ export declare class CompilingMappingDeleteQuery<DB, TB extends keyof DB & string, QB extends DeleteQueryBuilder<DB, TB, any>, ReturnCount, Parameters extends ParametersObject<Parameters>> implements ParameterizableMappingQuery { #private; protected readonly db: Kysely<DB>; protected readonly qb: QB; protected readonly transforms: Readonly<CountTransform<ReturnCount>>; constructor(db: Kysely<DB>, qb: QB, transforms: Readonly<CountTransform<ReturnCount>>); /** * Runs the query, returning the number of rows deleted, converted to * the required client representation. Accepts values for any parameters * embedded in the query. * * On the first execution, compiles and discards the underlying Kysely * query builder. Subsequent executions reuse the compiled query. * @param params Record characterizing the parameter names and types. * Pass in `{}` if the query has no parameters. * @returns Number of rows deleted, in client-requested representation. */ returnCount(params: Parameters): Promise<ReturnCount>; /** * Runs the query, deleting the indicated rows, returning nothing. * Accepts values for any parameters embedded in the query. * * On the first execution, compiles and discards the underlying Kysely * query builder. Subsequent executions reuse the compiled query. * @param params Record characterizing the parameter names and types. * Pass in `{}` if the query has no parameters. * @returns `true` if any rows were deleted, `false` otherwise. */ run(params: Parameters): Promise<boolean>; } //# sourceMappingURL=compiling-delete-query.d.ts.map