import db from "@/db/db"; import { projects } from "@/db/schema"; import { Item, items } from "@/db/schema/items"; import { formListsView, tagTypeClassFormMappings } from "@/db/schema/vendorData"; import { eq, inArray, not, asc, desc, and, ilike, gte, lte, count, gt, } from "drizzle-orm"; import { PgTransaction } from "drizzle-orm/pg-core"; export async function selectFormLists( tx: PgTransaction, params: { where?: any; orderBy?: (ReturnType | ReturnType)[]; offset?: number; limit?: number; } ) { const { where, orderBy, offset = 0, limit = 10 } = params; return tx .select() .from(formListsView) .where(where) .orderBy(...(orderBy ?? [])) .offset(offset) .limit(limit); } /** 총 개수 count */ export async function countFormLists( tx: PgTransaction, where?: any ) { const res = await tx .select({ count: count() }) .from(formListsView) .where(where); return res[0]?.count ?? 0; }