import { BuiltInParamValues } from "./builtins"; import { ClientOptions } from "../api/client"; import { BuiltInRun } from "../api/types"; export type TransactionMode = "auto" | "readOnly" | "readWrite" | "none"; export type QueryOptions = { args?: Record | null; transactionMode?: TransactionMode | null; client?: ClientOptions; }; export type QueryExecOutput = { __airplaneSentinelType: "QueryExecOutput"; rows_affected: number; }; type QueryExecOutputWithoutSentinel = { rows_affected: number; }; type QType = TRow extends QueryExecOutput ? QueryExecOutputWithoutSentinel : TRow[]; type Row = QueryExecOutput | Record; /** * A SQL query either returns a list of rows, where each row is typed by `TRow` * or it is a DDL query without a `RETURNING` clause. To type the latter case, * provide `QueryExecOutput` as `TRow`. For example: * * query(...): BuiltInRun<..., {Q1: {rows_affected: number}}> * query<{name: string}>(...): BuiltInRun<..., {Q1: {name: string}[]}> * @param sqlResource The alias or slug of the DB resource to query * @param query The SQL query to execute. Can be DDL or DML and can include multiple queries separated by semicolons. Multiple queries will be executed together as a transaction. * @param opts Additional configuration options */ export declare function query>(sqlResource: string, query: string, opts?: QueryOptions): Promise; }>>; /** * A SQL query either returns a list of rows, where each row is typed by `TRow` * or it is a DDL query without a `RETURNING` clause. To type the latter case, * provide `QueryExecOutput` as `TRow`. For example: * * query(...): BuiltInRun<..., {Q1: {rows_affected: number}}> * query<{name: string}>(...): BuiltInRun<..., {Q1: {name: string}[]}> * @param sqlResource The alias or slug of the DB resource to query * @param query The SQL query to execute. Can be DDL or DML and can include multiple queries separated by semicolons. Multiple queries will be executed together as a transaction. * @param opts Additional configuration options */ export declare function query(sqlResource: string, query: string, opts?: QueryOptions): Promise; Q2: QType; }>>; /** * A SQL query either returns a list of rows, where each row is typed by `TRow` * or it is a DDL query without a `RETURNING` clause. To type the latter case, * provide `QueryExecOutput` as `TRow`. For example: * * query(...): BuiltInRun<..., {Q1: {rows_affected: number}}> * query<{name: string}>(...): BuiltInRun<..., {Q1: {name: string}[]}> * @param sqlResource The alias or slug of the DB resource to query * @param query The SQL query to execute. Can be DDL or DML and can include multiple queries separated by semicolons. Multiple queries will be executed together as a transaction. * @param opts Additional configuration options */ export declare function query(sqlResource: string, query: string, opts?: QueryOptions): Promise; Q2: QType; Q3: QType; }>>; /** * A SQL query either returns a list of rows, where each row is typed by `TRow` * or it is a DDL query without a `RETURNING` clause. To type the latter case, * provide `QueryExecOutput` as `TRow`. For example: * * query(...): BuiltInRun<..., {Q1: {rows_affected: number}}> * query<{name: string}>(...): BuiltInRun<..., {Q1: {name: string}[]}> * @param sqlResource The alias or slug of the DB resource to query * @param query The SQL query to execute. Can be DDL or DML and can include multiple queries separated by semicolons. Multiple queries will be executed together as a transaction. * @param opts Additional configuration options */ export declare function query(sqlResource: string, query: string, opts?: QueryOptions): Promise; Q2: QType; Q3: QType; Q4: QType; }>>; /** * A SQL query either returns a list of rows, where each row is typed by `TRow` * or it is a DDL query without a `RETURNING` clause. To type the latter case, * provide `QueryExecOutput` as `TRow`. For example: * * query(...): BuiltInRun<..., {Q1: {rows_affected: number}}> * query<{name: string}>(...): BuiltInRun<..., {Q1: {name: string}[]}> * @param sqlResource The alias or slug of the DB resource to query * @param query The SQL query to execute. Can be DDL or DML and can include multiple queries separated by semicolons. Multiple queries will be executed together as a transaction. * @param opts Additional configuration options */ export declare function query(sqlResource: string, query: string, opts?: QueryOptions): Promise; Q2: QType; Q3: QType; Q4: QType; Q5: QType; }>>; export {};