import { Metric } from "gscdump/query"; /** * Standard SQL `LIKE` escape. Backslash is the explicit ESCAPE char so * literal `%`, `_`, and `\` survive a `contains` predicate unchanged. */ declare function escapeLike(value: string): string; /** * Per-metric raw SQL aggregate expression. * * - `clicks` / `impressions` cast to DOUBLE so DuckDB SUM doesn't return * BIGINT (which loses through JSON / Workers RPC). * - `position` reverses the ingestion offset (`sum_position = position - 1` * summed; divide by impressions and add 1 back). */ declare const METRIC_EXPR: Record; /** * Top-level page predicate: matches paths with at most one `/`. Parameterized * on the resolved column expression so drizzle can pass a column ref. */ declare function topLevelPagePredicateSql(pathExpr: string): string; /** * How a canonicalized date column is emitted by {@link dateReplaceClause}: * - `'date'` keeps a real `DATE` value (`CAST(col AS DATE)`). Right for views * and `.duckdb` exports the app re-queries, where the column type matters. * - `'string'` emits an ISO `YYYY-MM-DD` string (`strftime(CAST(col AS DATE)…)`). * Right for row materialisation to JSON/CSV/NDJSON, where a `DATE` would * serialize as an opaque object / epoch. */ type DateCanonicalForm = 'date' | 'string'; /** * Build a `read_parquet` `REPLACE (…)` clause that canonicalizes legacy `date` * columns. `date` lands as VARCHAR in older parquets (BYTE_ARRAY/UTF8, written * before the schema enforced DATE); DuckDB infers the column type from the file, * so without this every read path would expose VARCHAR despite SCHEMAS declaring * DATE. The `CAST(col AS DATE)` is a no-op for already-DATE columns and * vectorized parsing for VARCHAR ones, so output stays canonical either way. * * Pure: the caller passes the table's DATE column names (derived from `SCHEMAS`) * so this fragment carries no schema/drizzle dependency. Returns `''` when the * table has no DATE columns, so callers can interpolate it unconditionally: * `SELECT * ${dateReplaceClause(cols)} FROM read_parquet(…)`. */ declare function dateReplaceClause(dateColumns: readonly string[], form?: DateCanonicalForm): string; export { DateCanonicalForm, METRIC_EXPR, dateReplaceClause, escapeLike, topLevelPagePredicateSql };