import { OnModuleDestroy, OnModuleInit } from '@nestjs/common'; /** RunResult compatible with better-sqlite3 for callers that use .changes / .lastInsertRowid */ export interface RunResult { changes: number; lastInsertRowid: number; } export declare class DatabaseService implements OnModuleInit, OnModuleDestroy { private sqlDb; private dbPath; private initPromise; onModuleInit(): Promise; private doInit; private getDb; private runMigrations; run(sql: string, params?: unknown[]): RunResult; /** * 使用文件 DB 时立即落盘。每次 run() 写入后都会调用,保证「每次保存马上写到磁盘」。 * 落盘失败时重新抛出,便于上层返回错误、前端不乐观更新,避免「删了但重启又出现」。 */ private persistIfFile; /** 供删除等关键操作后显式落盘,确保删除结果持久化 */ persist(): void; get(sql: string, params?: unknown[]): T | undefined; all(sql: string, params?: unknown[]): T[]; onModuleDestroy(): void; }