import { type EntityMeta, type FieldKey, type FieldOptions, type JsonMergeOp, type Query, type QueryComparisonOptions, type QueryConflictPaths, type QueryContext, type QueryDialect, type QueryOptions, type QueryPager, QueryRaw, type QueryRawFnOptions, type QuerySearch, type QuerySelect, type QuerySelectOptions, type QuerySortMap, type QueryWhere, type QueryWhereArray, type QueryWhereFieldOperatorMap, type QueryWhereMap, type QueryWhereOptions, type RelationOptions, type SqlDialect, type SqlQueryDialect, type Type, type UpdatePayload } from '../type/index.js'; import { type CallbackKey } from '../util/index.js'; import { AbstractDialect } from './abstractDialect.js'; export declare abstract class AbstractSqlDialect extends AbstractDialect implements QueryDialect, SqlQueryDialect { readonly dialect: SqlDialect; get escapeIdChar(): "\"" | "`"; get beginTransactionCommand(): string; get commitTransactionCommand(): string; get rollbackTransactionCommand(): string; createContext(): QueryContext; addValue(values: unknown[], value: unknown): string; placeholder(_index: number): string; returningId(entity: Type): string; search(ctx: QueryContext, entity: Type, q?: Query, opts?: QueryOptions): void; selectFields(ctx: QueryContext, entity: Type, select: QuerySelect | QueryRaw[] | undefined, opts?: QuerySelectOptions): void; select(ctx: QueryContext, entity: Type, select: QuerySelect | QueryRaw[] | undefined, opts?: QueryOptions): void; protected selectRelationFields(ctx: QueryContext, entity: Type, select: QuerySelect | undefined, opts?: { prefix?: string; }): void; protected selectRelationJoins(ctx: QueryContext, entity: Type, select: QuerySelect | undefined, opts?: { prefix?: string; }): void; /** * Iterates over joinable (11/m1) relations for a given select, resolving shared metadata. * Used by both `selectRelationFields` and `selectRelationJoins` to avoid duplicated iteration logic. */ private forEachJoinableRelation; where(ctx: QueryContext, entity: Type, where?: QueryWhere, opts?: QueryWhereOptions): void; compare(ctx: QueryContext, entity: Type, key: string, val: unknown, opts?: QueryComparisonOptions): void; protected compareLogicalOperator(ctx: QueryContext, entity: Type, key: '$and' | '$or' | '$not' | '$nor', val: QueryWhereArray, opts: QueryComparisonOptions): void; compareFieldOperator>(ctx: QueryContext, entity: Type, key: FieldKey, op: K, val: QueryWhereFieldOperatorMap[K], opts?: QueryOptions): void; protected addValues(ctx: QueryContext, vals: unknown[]): void; /** * Build a comparison condition for a JSON field. * Used by both `$elemMatch` and dot-notation paths. Each dialect provides a `JsonFieldConfig`. */ protected buildJsonFieldCondition(ctx: QueryContext, config: JsonFieldConfig, jsonPath: string, op: string, value: unknown): string; getComparisonKey(ctx: QueryContext, entity: Type, key: FieldKey, { prefix }?: QueryOptions): void; sort(ctx: QueryContext, entity: Type, sort: QuerySortMap | undefined, { prefix }: QueryOptions): void; pager(ctx: QueryContext, opts: QueryPager): void; count(ctx: QueryContext, entity: Type, q: QuerySearch, opts?: QueryOptions): void; find(ctx: QueryContext, entity: Type, q?: Query, opts?: QueryOptions): void; insert(ctx: QueryContext, entity: Type, payload: E | E[], opts?: QueryOptions): void; update(ctx: QueryContext, entity: Type, q: QuerySearch, payload: UpdatePayload, opts?: QueryOptions): void; upsert(ctx: QueryContext, entity: Type, conflictPaths: QueryConflictPaths, payload: E | E[]): void; protected getUpsertUpdateAssignments(ctx: QueryContext, meta: EntityMeta, conflictPaths: QueryConflictPaths, payload: E | E[], callback?: (columnName: string) => string): string; protected getUpsertConflictPathsStr(meta: EntityMeta, conflictPaths: QueryConflictPaths): string; delete(ctx: QueryContext, entity: Type, q: QuerySearch, opts?: QueryOptions): void; escapeId(val: string, forbidQualified?: boolean, addDot?: boolean): string; protected getPersistables(ctx: QueryContext, meta: EntityMeta, payload: E | E[], callbackKey: CallbackKey): Record[]; protected getPersistable(ctx: QueryContext, meta: EntityMeta, payload: E, callbackKey: CallbackKey): Record; protected formatPersistableValue(ctx: QueryContext, field: FieldOptions | undefined, value: unknown): void; /** * Generate SQL for a JSONB merge and/or unset operation. * Called from `update()` when a field value has `$merge` and/or `$unset` operators. * Generates the full `"col" = ` assignment. * * Base implementation uses MySQL-compatible syntax. Override in dialect subclasses. */ protected formatJsonMerge(ctx: QueryContext, escapedCol: string, value: JsonMergeOp): void; /** * Checks if a value is a `$merge`/`$unset` operator object. */ protected isJsonMergeOp(value: unknown): value is JsonMergeOp; /** Escapes a JSON key for safe interpolation into SQL string literals. */ protected escapeJsonKey(key: string): string; getRawValue(ctx: QueryContext, opts: QueryRawFnOptions & { value: QueryRaw; autoPrefixAlias?: boolean; }): void; /** * Resolves a dot-notation key to its JSON field metadata. * Shared by `where()` and `sort()` to detect 'column.path' keys where 'column' is a JSON/JSONB field. * * @returns resolved metadata or `undefined` if the key is not a JSON dot-notation path */ protected resolveJsonDotPath(meta: EntityMeta, key: string, prefix?: string): { root: string; jsonPath: string; config: JsonFieldConfig; } | undefined; /** * Compare a JSONB dot-notation path, e.g. `'settings.isArchived': { $ne: true }`. * Receives a pre-resolved `resolveJsonDotPath` result to avoid redundant computation. */ protected compareJsonPath(ctx: QueryContext, resolved: { jsonPath: string; config: JsonFieldConfig; }, val: unknown): void; /** * Returns a dialect-specific `JsonFieldConfig` for accessing a nested JSON path. * Dialects should override this to provide their specific JSON accessor syntax. * * @param escapedColumn - The escaped column name (possibly prefixed with table name) * @param jsonPath - The dot-separated path within the JSON field (e.g. 'isArchived' or 'theme.color') */ protected getJsonFieldConfig(escapedColumn: string, jsonPath: string): JsonFieldConfig; /** * Returns the dialect-invariant portion of `JsonFieldConfig`. * Dialects override this to provide casts, operators, and value binding. * Both `getJsonFieldConfig` (dot-notation) and `buildJsonFieldOperator` ($elemMatch) compose with this. */ protected getBaseJsonConfig(): Omit; /** * Normalizes a raw WHERE value into an operator map. * Arrays become `$in`, scalars/null become `$eq`, objects pass through. */ private normalizeWhereValue; /** * Filter by ManyToMany or OneToMany relation using an EXISTS subquery. * Generates: `EXISTS (SELECT 1 FROM ... WHERE local_fk = parent.id AND ...)` */ protected compareRelation(ctx: QueryContext, entity: Type, key: string, val: QueryWhereMap, rel: RelationOptions, opts: QueryComparisonOptions): void; abstract escape(value: unknown): string; } /** * Configuration for JSON field operations. * Each SQL dialect provides its own config to the shared buildJsonFieldCondition method. */ export type JsonFieldConfig = { /** Produces the field accessor expression, e.g. `elem->>'name'` or `json_extract(value, '$.name')` */ fieldAccessor: (field: string) => string; /** Wraps an expression for numeric comparison, e.g. `(expr)::numeric` or `CAST(expr AS REAL)` */ numericCast: (expr: string) => string; /** The LIKE keyword to use for case-sensitive matching, e.g. `'LIKE'` */ likeFn: string; /** Builds a case-insensitive LIKE expression from a field and placeholder, e.g. `LOWER(field) LIKE ph` or `field ILIKE ph` */ ilikeExpr: (field: string, placeholder: string) => string; /** The regexp operator, e.g. `'REGEXP'` or `'~'` */ regexpOp: string; /** Binds a value and returns its placeholder string */ addValue: (ctx: QueryContext, value: unknown) => string; /** Optional: custom $in expression (e.g. Postgres `= ANY()`). If omitted, uses `IN (v1, v2, ...)` */ inExpr?: (field: string, placeholder: string) => string; /** Optional: custom $nin expression (e.g. Postgres `<> ALL()`). If omitted, uses `NOT IN (v1, v2, ...)` */ ninExpr?: (field: string, placeholder: string) => string; /** Optional: null-safe `$ne` (e.g. Postgres `IS DISTINCT FROM`, SQLite `IS NOT`). If omitted, uses `<>` */ neExpr?: (field: string, placeholder: string) => string; }; //# sourceMappingURL=abstractSqlDialect.d.ts.map