| 1 | import type * as athena from "@distilled.cloud/aws/athena"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { WorkGroup } from "./WorkGroup.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `athena:GetQueryResults`. |
| 8 | * |
| 9 | * Reads one page of a completed query's result set (raw rows + column |
| 10 | * metadata) — use `NextToken`/`MaxResults` to paginate large results. For the |
| 11 | * common run-and-decode flow, prefer the composite {@link Query} binding. |
| 12 | * Provide the implementation with |
| 13 | * `Effect.provide(AWS.Athena.GetQueryResultsHttp)`. |
| 14 | * ### Reading Results |
| 15 | * **Example:** Page Through Query Results |
| 16 | * ```typescript |
| 17 | * // init — bind the operation to the workgroup |
| 18 | * const getQueryResults = yield* AWS.Athena.GetQueryResults(workGroup); |
| 19 | * |
| 20 | * // runtime |
| 21 | * const page = yield* getQueryResults({ QueryExecutionId: id, MaxResults: 100 }); |
| 22 | * console.log(page.ResultSet?.Rows?.length, page.NextToken); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface GetQueryResults extends Binding.Service< |
| 28 | GetQueryResults, |
| 29 | "AWS.Athena.GetQueryResults", |
| 30 | ( |
| 31 | workGroup: WorkGroup, |
| 32 | ) => Effect.Effect< |
| 33 | ( |
| 34 | request: athena.GetQueryResultsInput, |
| 35 | ) => Effect.Effect< |
| 36 | athena.GetQueryResultsOutput, |
| 37 | athena.GetQueryResultsError |
| 38 | > |
| 39 | > |
| 40 | > {} |
| 41 | |
| 42 | export const GetQueryResults = Binding.Service<GetQueryResults>( |
| 43 | "AWS.Athena.GetQueryResults", |
| 44 | ); |