Using values from an input

Hello! I'm trying to solve an issue I have with an endpoint I'm working on. I have to be able to provide values to override in the query, something like the mock-up code bellow. Is something like this possible?
const overridenValues = new Map<Id, Date>([[1, "2025-01-01"]])

const query = db
.select({
productId: products.id,
})
.from(products)
.where(
gte(
products.added,
sql`coalesce(${format(overridenValues.get(products.id), "yyyy-MM-dd")}, ${products.from})`
),
)
const overridenValues = new Map<Id, Date>([[1, "2025-01-01"]])

const query = db
.select({
productId: products.id,
})
.from(products)
.where(
gte(
products.added,
sql`coalesce(${format(overridenValues.get(products.id), "yyyy-MM-dd")}, ${products.from})`
),
)
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?