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. The query syntax is shared by postgres, d1, and dowe.
1 / 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.
handler blogDetail
database db provider:"dowe" host:env.DOWE_HOST port:env.DOWE_PORT account:env.DOWE_USER secret:env.DOWE_PASSWORD name:"content"
query blogs conn:db.list table:"blogs"
query blog conn:db.read table:"blogs" where:{ id:req.params.id } required:true
return json:{ list:blogs selected:blog }Operation | Use it for |
|---|---|
No dataThere are no records to display | |
2 / SQL-LIKE
Use query for a supported read expression
SQL-like input is a static, validated string. The portable subset supports projections, AS aliases, multiple equality joins, equality filters joined by AND, ORDER BY, LIMIT, OFFSET, and ?N parameters. Do not interpolate values from body, params, query strings, or headers into SQL.
handler scheduledAppointments
database db provider:"dowe" host:env.DOWE_HOST port:env.DOWE_PORT account:env.DOWE_USER secret:env.DOWE_PASSWORD name:"clinic"
query rows conn:db.query sql:"select appointments.patientName, appointments.startsAt from appointments where status = \"scheduled\" order by startsAt"
return json:{ ok:true data:rows }