📜  typeorm 中的范围 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:45.857000             🧑  作者: Mango

代码示例1
class UserScopes extends SelectQueryBuilder {
  get notDeleted(): UserScopes {
    return this.andWhere("state != :state", {state: "deleted"});
  }
}

@EntityRepository(User)
export class UserRepository extends Repository {
  get scoped(): UserScopes {
    return new UserScopes(this.createQueryBuilder("user"));
  }
}