aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-11-23 11:23:16 +0000
committerChristopher Baines <mail@cbaines.net>2019-11-23 11:23:16 +0000
commit6fad559b3256dd528dc01061043290455a0b6141 (patch)
tree0057385a7cd9e5fab054df4c8f051076bc5b3623 /guix-data-service
parent53652db9cab9604a96d82618c110a0d77b7dece5 (diff)
downloaddata-service-6fad559b3256dd528dc01061043290455a0b6141.tar
data-service-6fad559b3256dd528dc01061043290455a0b6141.tar.gz
Improve select-build-servers to convert strings to appropriate types
Diffstat (limited to 'guix-data-service')
-rw-r--r--guix-data-service/builds.scm4
-rw-r--r--guix-data-service/model/build-server.scm18
2 files changed, 16 insertions, 6 deletions
diff --git a/guix-data-service/builds.scm b/guix-data-service/builds.scm
index 754ef89..8a92586 100644
--- a/guix-data-service/builds.scm
+++ b/guix-data-service/builds.scm
@@ -18,7 +18,7 @@
(for-each
(match-lambda
((id url lookup-all-derivations?)
- (when (string=? lookup-all-derivations? "t")
+ (when lookup-all-derivations?
(query-build-server conn id url))))
build-servers))))
@@ -166,7 +166,7 @@
") "
"LIMIT 1000"))
- (exec-query conn query (list build-server-id)))
+ (exec-query conn query (list (number->string build-server-id))))
(define (select-derivations-with-no-known-build conn)
(define query
diff --git a/guix-data-service/model/build-server.scm b/guix-data-service/model/build-server.scm
index d75f6c8..3f31626 100644
--- a/guix-data-service/model/build-server.scm
+++ b/guix-data-service/model/build-server.scm
@@ -1,9 +1,19 @@
(define-module (guix-data-service model build-server)
+ #:use-module (ice-9 match)
#:use-module (squee)
#:export (select-build-servers))
(define (select-build-servers conn)
- (exec-query conn
- (string-append
- "SELECT id, url, lookup_all_derivations "
- "FROM build_servers")))
+ (define query
+ "
+SELECT id, url, lookup_all_derivations
+FROM build_servers
+ORDER BY id")
+
+ (map
+ (match-lambda
+ ((id url lookup-all-derivations)
+ (list (string->number id)
+ url
+ (string=? lookup-all-derivations "t"))))
+ (exec-query conn query)))