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.
1 Reply
Teapot
Teapot2y ago
Hello! I was wondering what is your solution with the sql string for this problem.
Want results from more Discord servers?
Add your server