SERVER / DATABASE / READ

Select and read

Use list for a table collection, read for one equality-filtered record, and query when the supported SQL-like grammar expresses a read more clearly.

Database overview

ORM

List a table or require one record

required:true turns an empty read into a controlled 404 for a JSON endpoint. The filter remains equality-based and database-owned.

dowe
handler blogDetail req
  db db name:"content"
  query blogs db:db.list table:"blogs"
  query blog db:db.read table:"blogs" where:{ id:req.params.id } required:true
  return response json:{ list:blogs selected:blog }

SQL-LIKE

Use query for a supported read expression

SQL-like input is a static, validated string. Do not interpolate values from body, params, query strings, or headers into SQL.

dowe
handler scheduledAppointments req
  db db name:"clinic"
  query rows db:db.query sql:"select appointments.patientName, appointments.startsAt from appointments where status = \"scheduled\" order by startsAt"
  return response json:{ ok:true data:rows }

list

Returns JSON-compatible records from one declared table.

read

Returns one record or null, with required:true available for controlled absence.