Created
April 7, 2019 23:26
-
-
Save danielbraun/f3ad8d4f389ef94737b1123e60cc55c1 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
(let [per-page 25 | |
page 2 | |
page-count (sql/call :ceiling (sql/call :/ :%count.* per-page)) | |
] | |
(-> {:select [[:%count.* :total_count] | |
[page-count :page-count] | |
[(sql/call :< page page-count) :has-next?] | |
[(sql/call :> page 1) :has-previous?] | |
[page :current_page] | |
] | |
:from [:accounts]} | |
db/query | |
clojure.pprint/print-table)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment