1{-# language FlexibleContexts #-}
12import Rel8.Query ( Query )
13import Rel8.Query.Aggregate ( aggregate )
14import Rel8.Query.Maybe ( optional )
15import Rel8.Schema.Context ( DB )
16import Rel8.Table ( Table )
17import Rel8.Table.Aggregate ( listAgg, nonEmptyAgg )
18import Rel8.Table.List ( ListTable )
19import Rel8.Table.Maybe ( maybeTable )
20import Rel8.Table.NonEmpty ( NonEmptyTable )
23some :: Table DB a => Query a -> Query (NonEmptyTable a)
24some = aggregate . fmap nonEmptyAgg
27-- | Aggregate a 'Query' into a 'ListTable'. If the supplied query returns 0
28-- rows, this function will produce a 'Query' that returns one row containing
29-- the empty @ListTable@. If the supplied @Query@ does return rows, @many@ will
30-- return exactly one row, with a @ListTable@ collecting all returned rows.
32-- @many@ is analogous to 'Control.Applicative.many' from
33-- @Control.Applicative@.
34many :: Table DB a => Query a -> Query (ListTable a)
35many = fmap (maybeTable mempty id) . optional . aggregate . fmap listAgg
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list