aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-04-08 21:03:29 +0100
committerChristopher Baines <mail@cbaines.net>2019-04-08 21:03:29 +0100
commit77397538f703abe6621b89fe8bc0bb023ec01467 (patch)
treedb417af7cbc1aa0552937321ecade7ef145a04b6
parent1cdbdef513f9266f32e16cec7cd0620ebf1db544 (diff)
downloaddata-service-77397538f703abe6621b89fe8bc0bb023ec01467.tar
data-service-77397538f703abe6621b89fe8bc0bb023ec01467.tar.gz
Add a function to get a count of derivations
-rw-r--r--guix-data-service/model/derivation.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm
index 84801a9..e5de539 100644
--- a/guix-data-service/model/derivation.scm
+++ b/guix-data-service/model/derivation.scm
@@ -9,6 +9,7 @@
#:use-module (guix derivations)
#:use-module (guix-data-service model utils)
#:export (valid-systems
+ count-derivations
select-derivation-by-file-name
select-derivation-outputs-by-derivation-id
select-derivation-by-output-filename
@@ -27,6 +28,12 @@
conn
"SELECT DISTINCT system FROM derivations ORDER BY 1")))
+(define (count-derivations conn)
+ (first
+ (exec-query
+ conn
+ "SELECT COUNT(*) FROM derivations")))
+
(define (select-existing-derivations file-names)
(string-append "SELECT id, file_name "
"FROM derivations "