Option filter parameters

Hi! Love using drizzle so far! Had a quick question (not a bug):

  const res = await ctx.database
    .select()
    .from(worker)
    .where(
      and(
        eq(worker.locationUid, input.location),
        isNull(worker.deletedAt),
        ilike(worker.name, "%{input.name}%")
      )
    )


If I have a query like this, and input.name might be
null
(in which case I want to skip filtering by this), is there a short-hand for enabling that behavior? Right now I'm putting filters into an array like:

[..., input.name && ilike(worker.name, "%{input.name}%) : null].filter(v => v)


which is fine, just wondering if this is a good approach. thanks!
Was this page helpful?