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
| 1 | import type * as sdb from "@distilled.cloud/aws/simpledb"; |
| 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 { Domain } from "./Domain.ts"; |
| 6 | |
| 7 | export interface SelectRequest extends Omit<sdb.SelectRequest, "SelectExpression"> { |
| 8 | /** |
| 9 | * The select expression (`select output_list from domain [where ...]`). |
| 10 | * |
| 11 | * Pass a function to receive the domain's resolved physical name — useful |
| 12 | * because generated domain names are not known until deploy time: |
| 13 | * `(domain) => \`select * from \\\`${domain}\\\`\``. |
| 14 | */ |
| 15 | SelectExpression: string | ((domainName: string) => string); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Runtime binding for `sdb:Select`. |
| 20 | * |
| 21 | * Bind this operation to a {@link Domain} inside a function runtime. |
| 22 | * `Select` addresses the domain inside the expression itself rather than via |
| 23 | * a request field, so the client accepts either a literal expression or a |
| 24 | * function of the domain's resolved physical name. |
| 25 | * ### Querying Items |
| 26 | * **Example:** Select All Items |
| 27 | * ```typescript |
| 28 | * const select = yield* AWS.SimpleDB.Select(domain); |
| 29 | * |
| 30 | * const result = yield* select({ |
| 31 | * SelectExpression: (domain) => `select * from \`${domain}\``, |
| 32 | * ConsistentRead: true, |
| 33 | * }); |
| 34 | * // result.Items: [{ Name: "user#123", Attributes: [...] }, ...] |
| 35 | * ``` |
| 36 | * |
| 37 | * **Example:** Select with a Where Clause |
| 38 | * ```typescript |
| 39 | * const result = yield* select({ |
| 40 | * SelectExpression: (domain) => |
| 41 | * `select * from \`${domain}\` where plan = 'pro'`, |
| 42 | * }); |
| 43 | * ``` |
| 44 | * |
| 45 | * @binding |
| 46 | */ |
| 47 | export interface Select extends Binding.Service< |
| 48 | Select, |
| 49 | "AWS.SimpleDB.Select", |
| 50 | ( |
| 51 | domain: Domain, |
| 52 | ) => Effect.Effect< |
| 53 | (request: SelectRequest) => Effect.Effect<sdb.SelectResponse, sdb.SelectError, RuntimeContext> |
| 54 | > |
| 55 | > {} |
| 56 | export const Select = Binding.Service<Select>("AWS.SimpleDB.Select"); |