aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/datastore
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-12-21 13:53:48 +0000
committerChristopher Baines <mail@cbaines.net>2020-12-21 13:53:48 +0000
commit53c954ee69aad4ee66433f7ea772c908805535ac (patch)
treea1e2f43aa23b70ea8f194c2f8dc74c0e4b3c6ce1 /guix-build-coordinator/datastore
parentc5f43a0b3928515455ddc9e40a172d125769bb3c (diff)
downloadbuild-coordinator-53c954ee69aad4ee66433f7ea772c908805535ac.tar
build-coordinator-53c954ee69aad4ee66433f7ea772c908805535ac.tar.gz
When listing builds, sort by id, and allow filtering by after the id
Along with the limit, this enables pagination.
Diffstat (limited to 'guix-build-coordinator/datastore')
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index 7c9b4d0..1bc4aa0 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -1187,6 +1187,7 @@ WHERE uuid = :uuid"
(not-tags '())
(processed 'unset)
(canceled 'unset)
+ (after-id #f)
(limit 1000))
(call-with-worker-thread
(slot-ref datastore 'worker-reader-thread-channel)
@@ -1268,15 +1269,24 @@ INNER JOIN (
(cond
((eq? canceled #t) '("canceled = 1"))
((eq? canceled #f) '("canceled = 0"))
- (else '())))
+ (else '()))
+ (if after-id
+ '("uuid > :after_id")
+ '()))
" AND ")
"\n")
"")
+ "ORDER BY uuid ASC\n"
(if limit
(string-append "LIMIT " (number->string limit) "\n")
""))
#:cache? #f)))
+ (when after-id
+ (sqlite-bind-arguments
+ statement
+ #:after_id after-id))
+
(let ((result
(sqlite-map
(match-lambda