const [lengths, profiles] = await Promise.all([
db.select({ count: sql<number>`count(*)` }).from(users),
db
.select()
.from(users)
.where(
or(
ilike(users.name, `%${searchParams}%`),
ilike(users.location, `%${searchParams}%`)
)
)
.limit(itemPerPage)
.offset(offset),
]);
const count = lengths[0].count;
const [lengths, profiles] = await Promise.all([
db.select({ count: sql<number>`count(*)` }).from(users),
db
.select()
.from(users)
.where(
or(
ilike(users.name, `%${searchParams}%`),
ilike(users.location, `%${searchParams}%`)
)
)
.limit(itemPerPage)
.offset(offset),
]);
const count = lengths[0].count;