How to use the In function from typeorm

Find comprehensive JavaScript typeorm.In code examples handpicked from public code repositorys.

214
215
216
217
218
219
220
221
222
223
    driversIds = post.driversId.split(',').map(function (to) { return +to; });
    car = new car_entity_1.CarEntity();
    return [4 /*yield*/, manufacturer_entity_1.ManufacturerEntity.findOne({ where: { id: +post.manufacturerId } })];
case 1:
    manufacturer = _a.sent();
    return [4 /*yield*/, driver_entity_1.DriverEntity.find({ where: { id: typeorm_1.In(driversIds) } })];
case 2:
    drivers = _a.sent();
    car.manufacturer = manufacturer;
    car.drivers = drivers;
fork icon0
star icon0
watch icon0

188
189
190
191
192
193
194
195
196
197
 * @throws {Error}
 */
async fetchByIds(ids, repoName) {
    try {
        const repo = this.#dataSource.getRepository(repoName);
        let res = await repo.findBy({ id: orm.In(ids) });
        if (res.length === 0) {
            res = null;
        }
        return Promise.resolve(res);
fork icon0
star icon0
watch icon0