cursor-init/types/drizzle.type.ts
expressgy a23d336ebd refactor: 重构项目架构并标准化开发规范
- 重构项目结构:controllers/services -> modules模块化组织

- 新增Drizzle ORM集成和数据库schema定义

- 添加完整的开发规范文档(.cursor/rules/)

- 重新组织插件结构为子目录方式

- 新增用户模块和示例代码

- 更新类型定义并移除试验性代码

- 添加API文档和JWT使用示例

关联任务计划文档
2025-06-30 01:25:17 +08:00

52 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file Drizzle ORM类型定义
* @author hotok
* @date 2025-06-29
* @lastEditor hotok
* @lastEditTime 2025-06-29
* @description 定义Drizzle ORM相关的类型包括数据库实例和表类型
*/
import type { MySql2Database } from 'drizzle-orm/mysql2';
import type * as schema from '../src/plugins/drizzle/schema';
/**
* Drizzle数据库实例类型
*/
export type DrizzleDB = MySql2Database<typeof schema>;
/**
* 数据库表Schema类型
*/
export type DatabaseSchema = typeof schema;
/**
* 扩展Elysia Context添加数据库实例
*/
export interface DrizzleContext {
/** Drizzle数据库实例 */
db: DrizzleDB;
}
/**
* 数据库连接状态
*/
export type ConnectionStatus = 'connecting' | 'connected' | 'error' | 'disconnected';
/**
* 数据库连接信息
*/
export interface DatabaseConnectionInfo {
/** 连接状态 */
status: ConnectionStatus;
/** 连接主机 */
host: string;
/** 连接端口 */
port: number;
/** 数据库名称 */
database: string;
/** 连接时间 */
connectedAt?: Date;
/** 错误信息 */
error?: string;
}