Colin
Colin
Explore posts from servers
DTDrizzle Team
Created by Colin on 7/24/2023 in #help
Placeholder in updates
Hello, I just started using drizzle by doing a very simple todo app. I have some trouble understanding how to get dynamic values inside the object taken by the set function on update. Here is my non-working code:
const prepared = db.update(tasks)
.set({ state: placeholder('state') })
.where(eq(tasks.id, placeholder('id')))
.prepare('update-task')
const prepared = db.update(tasks)
.set({ state: placeholder('state') })
.where(eq(tasks.id, placeholder('id')))
.prepare('update-task')
The second placeholder (id) seems to work great but I can't figure anyway to make the state dynamic here in a prepared query. Maybe using a "raw sql" string would just work but this use case seems to frequent to just default to this. Have a great day, Colin.
2 replies