import { type SQL } from 'drizzle-orm';
import type { PgTable } from 'drizzle-orm/pg-core';
import type { QueryOp, QueryWhereResult } from '../../typings/routing/crud';
/** 压平 where 返回值，丢弃空条件 */
export declare function compactWhere(result: QueryWhereResult | undefined): SQL[];
/**
 * where 辅助（字段管理）
 *
 * - `between` / `range`：缺参自动跳过
 * - `eqRest`：剩余 body 字段等值，可用 map 指到 join 列
 * - `contains`：数组包含（fieldArray）；按库类型分支
 */
export declare const q: {
    between(col: unknown, min: unknown, max: unknown): SQL | undefined;
    range(col: unknown, start: unknown, end: unknown): SQL | undefined;
    eqRest(params: Record<string, unknown>, table: PgTable, map?: Record<string, unknown>): SQL[];
    /**
     * 数组包含（fieldArray / 业务手写）：
     * - PostgreSQL `integer[]`：arrayContains / arrayOverlaps
     * - PostgreSQL `json`/`jsonb`：`@>`
     * - MySQL / MariaDB：列用 `json`，`JSON_CONTAINS`
     * - SQLite：列用 `json`/`text` JSON，`json_each`
     *
     * MySQL/SQLite 无原生数组类型，tagIds 等请用 `json().$type<number[]>()`。
     */
    contains(col: unknown, value: unknown): SQL | undefined;
};
/** 是否需要 join/select（须走 queryWithOp；where/extend 拼进 where 后走 Service） */
export declare function needsAdvancedQuery(op?: QueryOp): boolean;
/**
 * 从请求体 + QueryOp 拼 where / orderBy（含 fieldArray、fieldRange、where、extend）
 */
export declare function buildQueryOp(table: PgTable, body: Record<string, unknown>, op?: QueryOp, request?: Request): Promise<{
    where?: SQL;
    orderBySql: SQL[];
}>;
