knox 修订了这个 Gist . 跳至此修订
1 file changed, 11 insertions
TypeORM-readme-48.ts(file created)
@@ -0,0 +1,11 @@ | |||
1 | + | const photos = await AppDataSource.getRepository(Photo) | |
2 | + | .createQueryBuilder("photo") // first argument is an alias. Alias is what you are selecting - photos. You must specify it. | |
3 | + | .innerJoinAndSelect("photo.metadata", "metadata") | |
4 | + | .leftJoinAndSelect("photo.albums", "album") | |
5 | + | .where("photo.isPublished = true") | |
6 | + | .andWhere("(photo.name = :photoName OR photo.name = :bearName)") | |
7 | + | .orderBy("photo.id", "DESC") | |
8 | + | .skip(5) | |
9 | + | .take(10) | |
10 | + | .setParameters({ photoName: "My", bearName: "Mishka" }) | |
11 | + | .getMany() |
更新
更早