TypeORM 真正难的地方,从来不是 API 记不住。
难的是你要同时建立这几个判断:
- 实体蓝图是不是建清楚了
- 关系外键到底握在哪一侧
- 简单查询该不该升级成 QueryBuilder
- 这批写入是不是必须走事务
- 这次结构变化能不能只靠实体改动,还是必须进 migration
- 这个项目更适合 Active Record 还是 Data Mapper
如果这些判断建立了,TypeORM 就不再是一堆零散方法名。
它会变成一支你能真正调度的施工总包:
entity是蓝图column是构件参数relation是连廊和管线repository是专属施工班组query builder是复杂施工单台transaction是封闭施工区migration是结构改造施工单
这时候你就不只是“会用 TypeORM”。
你是真的理解了:
为什么这支数据映射施工队能把业务模型和数据库工地接起来。
#官方来源链接清单
TypeORM Getting Started
https://typeorm.io/docs/getting-started/TypeORM Data Source
https://typeorm.io/docs/data-source/data-source/TypeORM Entities
https://typeorm.io/docs/entity/entities/TypeORM Relations
https://typeorm.io/docs/relations/relations/TypeORM Repository
https://typeorm.io/docs/working-with-entity-manager/working-with-repository/TypeORM Find Options
https://typeorm.io/docs/working-with-entity-manager/find-options/TypeORM Select Query Builder
https://typeorm.io/docs/query-builder/select-query-builder/TypeORM Transactions
https://typeorm.io/docs/advanced-topics/transactions/TypeORM Active Record vs Data Mapper
https://typeorm.io/docs/guides/active-record-data-mapper/TypeORM Migrations: How migrations work?
https://typeorm.io/docs/migrations/why/TypeORM Migrations: Setup
https://typeorm.io/docs/migrations/setup/TypeORM Migrations: Generating
https://typeorm.io/docs/migrations/generating/TypeORM Migrations: Executing and reverting
https://typeorm.io/docs/migrations/executing/Prisma ORM 总览(用于与 TypeORM 对照理解)
https://www.prisma.io/docs/ormPrisma Client Queries(用于与 TypeORM Repository / 查询风格对照)
https://www.prisma.io/docs/orm/prisma-client/queries/crudPostgreSQL
SELECT官方文档(用于理解原生 SQL 思维)
https://www.postgresql.org/docs/current/sql-select.htmlPostgreSQL
BEGIN/ 事务官方文档(用于理解原生事务思维)
https://www.postgresql.org/docs/current/sql-begin.html