aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-04-08 21:03:59 +0100
committerChristopher Baines <mail@cbaines.net>2019-04-08 21:03:59 +0100
commit0c72ee747c253ea538032c6593683af6a54af5d3 (patch)
treeee826e563040d2f1e513d478faef5597d01574f5 /guix-data-service/model
parent77397538f703abe6621b89fe8bc0bb023ec01467 (diff)
downloaddata-service-0c72ee747c253ea538032c6593683af6a54af5d3.tar
data-service-0c72ee747c253ea538032c6593683af6a54af5d3.tar.gz
Add a function to get a count of Guix revisions
Diffstat (limited to 'guix-data-service/model')
-rw-r--r--guix-data-service/model/guix-revision.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/guix-data-service/model/guix-revision.scm b/guix-data-service/model/guix-revision.scm
index 34df5e6..f03aa6d 100644
--- a/guix-data-service/model/guix-revision.scm
+++ b/guix-data-service/model/guix-revision.scm
@@ -1,11 +1,19 @@
(define-module (guix-data-service model guix-revision)
+ #:use-module (srfi srfi-1)
#:use-module (ice-9 match)
#:use-module (squee)
- #:export (most-recent-n-guix-revisions
+ #:export (count-guix-revisions
+ most-recent-n-guix-revisions
commit->revision-id
insert-guix-revision
guix-revision-exists?))
+(define (count-guix-revisions conn)
+ (first
+ (exec-query
+ conn
+ "SELECT COUNT(*) FROM guix_revisions")))
+
(define (most-recent-n-guix-revisions conn n)
(exec-query conn "SELECT * FROM guix_revisions ORDER BY id DESC LIMIT 10"))