Última actividad 1729146866

knox revisó este gist 1729146866. Ir a la revisión

1 file changed, 11 insertions

TypeORM-readme-48.ts(archivo creado)

@@ -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()
Siguiente Anterior