| 1 | import type * as spanner from "@distilled.cloud/gcp/spanner_v1"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { RuntimeContext } from "../../RuntimeContext.ts"; |
| 5 | import type { Database } from "./Database.ts"; |
| 6 | |
| 7 | export interface GetDdlRequest extends Omit< |
| 8 | spanner.GetDdlProjectsInstancesDatabasesRequest, |
| 9 | "database" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Spanner `databases.getDdl`. |
| 14 | * |
| 15 | * Bind this operation to a {@link Database} in a Function/Action init |
| 16 | * phase. Provide {@link GetDdlHttp}. |
| 17 | * |
| 18 | * ### Reading Schema |
| 19 | * **Example:** Fetch live DDL |
| 20 | * ```typescript |
| 21 | * const getDdl = yield* GCP.Spanner.GetDdl(database); |
| 22 | * const { statements } = yield* getDdl(); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | * @category Spanner |
| 27 | */ |
| 28 | export interface GetDdl extends Binding.Service< |
| 29 | GetDdl, |
| 30 | "GCP.Spanner.GetDdl", |
| 31 | ( |
| 32 | database: Database, |
| 33 | ) => Effect.Effect< |
| 34 | ( |
| 35 | request?: GetDdlRequest, |
| 36 | ) => Effect.Effect< |
| 37 | spanner.GetDatabaseDdlResponse, |
| 38 | spanner.GetDdlProjectsInstancesDatabasesError, |
| 39 | RuntimeContext |
| 40 | > |
| 41 | > |
| 42 | > {} |
| 43 | |
| 44 | export const GetDdl = Binding.Service<GetDdl>("GCP.Spanner.GetDdl"); |