157af4399f
- 恢复 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 过时引用
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
// Sorted Set 操作
|
|
import { getClient } from './connection'
|
|
|
|
export async function zsetRange(id: string, key: string, start: number, stop: number, withScores: boolean): Promise<string[]> {
|
|
const client = getClient(id)
|
|
if (!client) throw new Error(`Client ${id} not found`)
|
|
if (withScores) return client.zrange(key, start, stop, 'WITHSCORES')
|
|
return client.zrange(key, start, stop)
|
|
}
|
|
|
|
export async function zsetSize(id: string, key: string): Promise<number> {
|
|
const client = getClient(id)
|
|
if (!client) throw new Error(`Client ${id} not found`)
|
|
return client.zcard(key)
|
|
}
|
|
|
|
export async function zsetAdd(id: string, key: string, score: number, member: string): Promise<number> {
|
|
const client = getClient(id)
|
|
if (!client) throw new Error(`Client ${id} not found`)
|
|
return client.zadd(key, score, member)
|
|
}
|
|
|
|
export async function zsetRemove(id: string, key: string, ...members: string[]): Promise<number> {
|
|
const client = getClient(id)
|
|
if (!client) throw new Error(`Client ${id} not found`)
|
|
return client.zrem(key, ...members)
|
|
}
|