@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 33 lines 1.04 KB
Raw
1 import * as Binding from "alchemy/Binding";
2 import type * as Effect from "effect/Effect";
3 import type { ReadRedisClient } from "./ReadRedis.ts";
4 import type { Redis } from "./Redis.ts";
5 import type { WriteRedisClient } from "./WriteRedis.ts";
6
7 /**
8 * Bind a {@link Redis} database with read + write access.
9 *
10 * `ReadWriteRedis` is the Context tag, the type, and the callable —
11 * `yield* Railway.ReadWriteRedis(Cache)`. Provide {@link ReadWriteRedisHttp}.
12 *
13 *
14 * ### Read and write
15 * **Example:** Round-trip a key
16 * ```typescript
17 * const cache = yield* Railway.ReadWriteRedis(Cache);
18 * yield* cache.set("marker", "hello");
19 * const value = yield* cache.get("marker");
20 * ```
21 *
22 * @binding
23 * @product Redis
24 */
25 export interface ReadWriteRedis extends Binding.Service<
26 ReadWriteRedis,
27 "Railway.ReadWriteRedis",
28 (redis: Redis) => Effect.Effect<ReadWriteRedisClient>
29 > {}
30
31 export const ReadWriteRedis = Binding.Service<ReadWriteRedis>("Railway.ReadWriteRedis");
32
33 export interface ReadWriteRedisClient extends ReadRedisClient, WriteRedisClient {}