Support for simple queries
Closed this issue · 2 comments
mageshb commented
Support for writing simple queries.
Following are the few that we would like to get it in
get, getBy, getAll, update
, updateBy, updateAll, delete
, deleteBy, deleteAll, insert
, insertRet, upsert, count
expipiplus1 commented
Doesn't dbrecord-opaleye
do most of these?
mageshb commented
Yes. But when you want to write simple queries (which does not involve join, projections) opaleye's arrowish interface could be bit heavy weight. Thought these functions would cater to those needs as shown in the example below.
get :: forall db table.Table db table => (Expr sc key -> Expr sc Bool) -> Maybe table
runPG $ do
userId10 <- get (\userId -> userId .== 10)
return userId10