import db from "@/db/db"; import { viewTagSubfields } 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 selectTagNumbering( tx: PgTransaction, params: { where?: any; // drizzle-orm의 조건식 (and, eq...) 등 orderBy?: (ReturnType | ReturnType)[]; offset?: number; limit?: number; } ) { const { where, orderBy, offset = 0, limit = 10 } = params; return tx .select() .from(viewTagSubfields) .where(where) .orderBy(...(orderBy ?? [])) .offset(offset) .limit(limit); } /** 총 개수 count */ export async function countTagNumbering( tx: PgTransaction, where?: any ) { const res = await tx.select({ count: count() }).from(viewTagSubfields).where(where); return res[0]?.count ?? 0; }