import { SortOrder } from './enums.js'; import { IModelDescriptor, IOrderByBuilder, IWhereBuilder, PrimaryKeyGeneration } from './interfaces.js'; /** Primary key column names in declaration order. Empty when the model has no @Primary(). */ export declare function pkColumns(descriptor: IModelDescriptor): string[]; export declare function hasPk(descriptor: IModelDescriptor): boolean; export declare function isCompositePk(descriptor: IModelDescriptor): boolean; /** * Coerces one primary key value into an ordered tuple matching `pkColumns(descriptor)`. * Accepts a scalar or a one-element array for single-column keys, and an array in key order * or a plain object keyed by column name for composite keys. */ export declare function normalizePkTuple(descriptor: IModelDescriptor, value: any): any[]; /** Reads the primary key off a row or model: a scalar for single-column keys, a tuple for composite. */ export declare function pkValueOf(source: any, descriptor: IModelDescriptor): any; /** Writes a primary key onto a row or model. Mirror image of {@link pkValueOf}. */ export declare function setPkValue(target: any, descriptor: IModelDescriptor, value: any): void; /** * Flattens the given columns of a row into one string, for use as a Map key or a lodash * `differenceBy` / `intersectionBy` iteratee where a tuple would compare by reference. * Each part is length-prefixed so `['ab', 'c']` and `['a', 'bc']` cannot collide. */ export declare function pkKeyStringFor(source: any, keys: string[]): string; /** {@link pkKeyStringFor} over a model's primary key columns. */ export declare function pkKeyString(source: any, descriptor: IModelDescriptor): string; /** * WHERE matching exactly one row by primary key. * Single column: `col = ?`, byte-identical to the pre-composite behaviour. * Composite: `( a = ? AND b = ? )`. */ export declare function wherePk(builder: IWhereBuilder, descriptor: IModelDescriptor, value: any): void; /** * WHERE matching any of `values`. * Single column: `col IN (?, ...)`. * Composite: `( ( a = ? AND b = ? ) OR ( a = ? AND b = ? ) )`. * An empty `values` matches nothing, consistent with `whereIn(col, [])` (B4b). */ export declare function whereAnyPk(builder: IWhereBuilder, descriptor: IModelDescriptor, values: any[]): void; /** * WHERE excluding all of `values` — the orphan-delete predicate. * Single column: `col NOT IN (?, ...)`. * Composite: De Morgan of {@link whereAnyPk} — `( ( a != ? OR b != ? ) AND ( a != ? OR b != ? ) )`. * An empty `values` adds no condition ( nothing is excluded ). */ export declare function whereNotAnyPk(builder: IWhereBuilder, descriptor: IModelDescriptor, values: any[]): void; /** * Appends one ORDER BY term per primary key column. Returns false when the model has no * primary key, so callers can fall back to unique columns or timestamps. */ export declare function orderByPk(builder: IOrderByBuilder, descriptor: IModelDescriptor, order: SortOrder): boolean; /** Generation strategy for one primary key column. Unrecorded columns default to `auto`. */ export declare function pkGeneration(descriptor: IModelDescriptor, column: string): PrimaryKeyGeneration; /** * Fills every `uuid`-generated primary key column that has no value yet. Called immediately * before insert so the key is known client-side without a database round-trip. Never overwrites * a value the caller supplied. */ export declare function generateClientSideKeys(target: any, descriptor: IModelDescriptor): void; /** Throws when an `assigned` primary key column has no value at insert time. */ export declare function assertAssignedKeys(target: any, descriptor: IModelDescriptor): void; //# sourceMappingURL=primary-keys.d.ts.map