@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 38 lines 1.14 KB
Raw
1 import type * as bigquery from "@distilled.cloud/gcp/bigquery_v2";
2 import * as Binding from "alchemy/Binding";
3 import type { RuntimeContext } from "alchemy/RuntimeContext";
4 import type * as Effect from "effect/Effect";
5 import type { Dataset } from "./Dataset.ts";
6
7 export interface QueryRequest extends bigquery.QueryRequest {}
8
9 /**
10 * Runtime binding for BigQuery `jobs.query`.
11 *
12 * Bind this operation to a {@link Dataset} in a Function/Action init phase.
13 * Provide {@link QueryHttp}. Unqualified table names resolve against the
14 * bound dataset. GoogleSQL is the default (`useLegacySql: false`).
15 *
16 * ### Querying
17 * **Example:** Run a GoogleSQL query
18 * ```typescript
19 * const query = yield* GCP.BigQuery.Query(dataset);
20 * const result = yield* query({ query: "SELECT 1 AS n" });
21 * ```
22 *
23 * @binding
24 * @category BigQuery
25 */
26 export interface Query extends Binding.Service<
27 Query,
28 "GCP.BigQuery.Query",
29 (
30 dataset: Dataset,
31 ) => Effect.Effect<
32 (
33 request: QueryRequest,
34 ) => Effect.Effect<bigquery.QueryResponse, bigquery.QueryJobsError, RuntimeContext>
35 >
36 > {}
37
38 export const Query = Binding.Service<Query>("GCP.BigQuery.Query");