Add `queryOrList` to `IHP.QueryBuilder`
amitaibu opened this issue · 1 comments
amitaibu commented
Use would be something like this:
action ProjectsAction = do
let values :: [(ProjectType, Int)] = [(ProjectTypeOngoing, 3), (ProjectTypeNotStarted, 2)]
valuePairToCondition :: (ProjectType, Int) -> QueryBuilder "projects"
valuePairToCondition (projectType, participants) =
query @Project
|> filterWhere (#projectType, projectType)
|> filterWhere (#participants, participants)
theQuery = queryOrList (map valuePairToCondition values)
projects <- fetch theQuery
render IndexView { .. }