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

main
ts 37 lines 1.26 KB
Raw
1 import * as Binding from "alchemy/Binding";
2 import type * as Effect from "effect/Effect";
3 import type { ReadTableClient } from "./ReadTable.ts";
4 import type { Table } from "./Table.ts";
5 import type { WriteTableClient } from "./WriteTable.ts";
6
7 export interface ReadWriteTableClient extends ReadTableClient, WriteTableClient {}
8
9 /**
10 * Read and write access to a BigQuery {@link Table}. Grants
11 * `roles/bigquery.dataEditor` on the table and `roles/bigquery.jobUser` on
12 * the project (job creation is project-only).
13 *
14 * ### Reading and writing
15 * **Example:** Insert then aggregate
16 * ```typescript
17 * const events = yield* GCP.BigQuery.ReadWriteTable(table);
18 * const tableId = yield* table.tableId;
19 * return Effect.gen(function* () {
20 * yield* events.insert([{ id: "a", score: 3 }]);
21 * const [total] = yield* events.query(
22 * `SELECT SUM(score) AS total FROM \`${yield* tableId}\``,
23 * );
24 * });
25 * // …provided with Effect.provide(GCP.BigQuery.ReadWriteTableHttp)
26 * ```
27 *
28 * @binding
29 * @category BigQuery
30 */
31 export interface ReadWriteTable extends Binding.Service<
32 ReadWriteTable,
33 "GCP.BigQuery.ReadWriteTable",
34 (table: Table) => Effect.Effect<ReadWriteTableClient>
35 > {}
36
37 export const ReadWriteTable = Binding.Service<ReadWriteTable>("GCP.BigQuery.ReadWriteTable");