Files
JRedisDesktop/electron/redis/string.ts
T
Jokul 157af4399f fix: 修复文件层级重构后的架构问题
- 恢复 IPC 类型声明 (src/electron-api.d.ts),修复 31 个 TS2339 错误
- 修复构建断裂:vite.config.ts 改回 electron.vite.config.ts
- 修复 2 个 verbatimModuleSyntax type-import 报错
- 修正 .gitignore 构建产物路径 (electron-dist/ -> dist-electron/ + release/)
- 清理 55+ 处过时路径注释
- 更新 AGENTS.md 架构文档与 IPC 通道表
- 修正 docs/ROADMAP.md 过时引用
2026-07-10 23:22:53 +08:00

34 lines
1.2 KiB
TypeScript

// String + ReJson 操作
import { getClient } from './connection'
export async function getStringValue(id: string, key: string): Promise<string | null> {
const client = getClient(id)
if (!client) throw new Error(`Client ${id} not found`)
return client.get(key)
}
export async function setStringValue(id: string, key: string, value: string): Promise<void> {
const client = getClient(id)
if (!client) throw new Error(`Client ${id} not found`)
await client.set(key, value)
}
// ReJson operations
export async function rejsonGet(id: string, key: string, path: string = '.'): Promise<string> {
const client = getClient(id)
if (!client) throw new Error(`Client ${id} not found`)
return (client as any).call('JSON.GET', key, path)
}
export async function rejsonSet(id: string, key: string, path: string, value: string): Promise<void> {
const client = getClient(id)
if (!client) throw new Error(`Client ${id} not found`)
await (client as any).call('JSON.SET', key, path, value)
}
export async function rejsonDel(id: string, key: string, path: string = '.'): Promise<number> {
const client = getClient(id)
if (!client) throw new Error(`Client ${id} not found`)
return (client as any).call('JSON.DEL', key, path)
}