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, 03:37 UTC
| 1 | import type * as DynamoDB from "@distilled.cloud/aws/dynamodb"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import type { Table } from "./Table.ts"; |
| 5 | |
| 6 | export interface GetItemRequest extends Omit<DynamoDB.GetItemInput, "TableName"> {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `dynamodb:GetItem`. |
| 10 | * |
| 11 | * Bind this operation to a `Table` inside a function runtime to get a callable |
| 12 | * that automatically injects the table name. |
| 13 | * ### Reading Data |
| 14 | * **Example:** Read a Single Item |
| 15 | * ```typescript |
| 16 | * const getItem = yield* AWS.DynamoDB.GetItem(table); |
| 17 | * |
| 18 | * const response = yield* getItem({ |
| 19 | * Key: { |
| 20 | * pk: { S: "user#123" }, |
| 21 | * }, |
| 22 | * }); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface GetItem extends Binding.Service< |
| 28 | GetItem, |
| 29 | "AWS.DynamoDB.GetItem", |
| 30 | <T extends Table>( |
| 31 | table: T, |
| 32 | ) => Effect.Effect< |
| 33 | (request: GetItemRequest) => Effect.Effect<DynamoDB.GetItemOutput, DynamoDB.GetItemError> |
| 34 | > |
| 35 | > {} |
| 36 | export const GetItem = Binding.Service<GetItem>("AWS.DynamoDB.GetItem"); |