Codxplore.com

Latest news:

Sahih al-Bukhari (সহীহ বুখারী) is a free Hadith application for android. This application is advertisement free. Download now https://play.google.com/store/apps/details?id=com.akramhossin.bukharisharif

How to use getManyAndCount function in SelectQueryBuilder


How to use getManyAndCount function in SelectQueryBuilder

TypeScript code snippets using typeorm.SelectQueryBuilder.getManyAndCount

const [models, pageCount] = await getRepository(Businesses)
            .createQueryBuilder('businesses')
            .leftJoinAndSelect("businesses.locations", "locations")
            .where("is_active = 1")
            .andWhere("is_deleted = 0")
            .skip(offset)
            .limit(perPage)
          .getManyAndCount();
 
if (models && models.length > 0) {
            let businessList = []
            for (let item of models) {
//your code goes here
            }
}
 
 

Views : 1041

Subscribe Us


Follow Us