SERVER / DATABASE / WRITE

Update

Update applies a patch to records selected by a static table and equality filter, then returns a change result through its query binding.

1 / PATCH

Filter by authority, then return fresh data

Use where to select the record. required:true produces a controlled 404 when no matching record exists. Read request props directly from req.body; a subsequent read can return the refreshed record. The query shape is shared by postgres, d1, and dowe.

dowe
handler updateBlog
  database db provider:"dowe" host:env.DOWE_HOST port:env.DOWE_PORT account:env.DOWE_USER secret:env.DOWE_PASSWORD name:"content"
  query updated conn:db.update table:"blogs" where:{ id:req.params.id } value:{ title:req.body.title content:req.body.content updatedAt:now } required:true
  query blog conn:db.read table:"blogs" where:{ id:req.params.id } required:true
  return json:{ ok:true changed:updated data:blog }
Rule
Guidance

No data

There are no records to display