dao-best-practice

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DAO规范化技能

DAO Standardization Skill

此技能帮助规范化DAO文件,使其符合项目的最佳实践。
This skill helps standardize DAO files to align with the project's best practices.

使用说明

Usage Instructions

  1. 识别需要规范化的DAO文件,通常位于
    apps/web/src/db/models/daos/
  2. 阅读参考指南:DAO最佳实践指南 以了解规范。
  3. 代码示例:DAO代码参考 作为参考。
  4. 使用检查清单验证文件是否符合规范。
  5. 重构文件以匹配指南中的模式。
重要: 调用完毕技能后,强制查看检查清单,并确保返回的内容完全匹配清单中的所有项目。
  1. Identify the DAO files that need standardization, typically located in
    apps/web/src/db/models/daos/
    .
  2. Read the reference guide: DAO Best Practices Guide to understand the specifications.
  3. Code example: DAO Code Reference as a reference.
  4. Use the Checklist to verify if the files comply with the specifications.
  5. Refactor the files to match the patterns in the guide.
Important: After invoking the skill, be sure to review the Checklist and ensure the returned content fully matches all items in the checklist.

核心规范

Core Specifications

  • 文件结构:文件名与表名一致,导出为对象。
  • 方法:使用驼峰命名,标准CRUD方法。
  • 类型安全:使用Drizzle类型推断。
  • 性能:使用分页、联表查询等。
如果需要更多细节,请阅读参考文件。
  • File structure: File names match table names, exported as objects.
  • Methods: Use camelCase naming, standard CRUD methods.
  • Type safety: Use Drizzle type inference.
  • Performance: Use pagination, join queries, etc.
For more details, please refer to the reference documents.