Last active
March 11, 2019 13:59
-
-
Save dariooddenino/20f590317271e03e133127a1744c49f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- first I want to select some elements to display in my table | |
select $ from $ \(foo `innerJoin` bar) -> do | |
on (foo ^. FooBar ==. bar ^. BarId) | |
where_ (foo ^. FooFoo ==. E.val True) | |
orderBy [asc (foo ^. FooId)] | |
offset (resultsPerPage * pageNum) | |
limit resultsPerPage | |
pure (foo, bar) | |
-- then I want to count the total to know how many pages are there | |
select $ from $ \(foo `innerJoin` bar) -> do | |
on (foo ^. FooBar ==. bar ^. BarId) | |
where_ (foo ^. FooFoo ==. E.val True) | |
pure countRows | |
-- they're identical except for the last lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment