aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-22 12:47:47 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-07-25 02:12:40 +0200
commit447d9f7ba81e90b2a8a799c11eea59d47060da2c (patch)
treed3f4a3a158fdeb282fd2fc530801d4c3294f2b34 /src
parenta44558e2ddf3e31a67193d70a850615aa0434e5c (diff)
downloadcuirass-447d9f7ba81e90b2a8a799c11eea59d47060da2c.tar
cuirass-447d9f7ba81e90b2a8a799c11eea59d47060da2c.tar.gz
database: Add 'assq-refs' procedure.
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/database.scm5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 8ce4153..d8d1ed2 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -21,6 +21,7 @@
#:use-module (ice-9 rdelim)
#:use-module (sqlite3)
#:export (;; Procedures.
+ assq-refs
db-init
db-open
db-close
@@ -93,6 +94,10 @@ database object."
"Close database object DB."
(sqlite-close db))
+(define* (assq-refs alst keys #:optional default-value)
+ (map (λ (key) (or (assq-ref alst key) default-value))
+ keys))
+
(define (db-add-evaluation db job)
"Store a derivation result in database DB and return its ID."
(sqlite-exec db "insert into build (job_spec, drv) values ('~A', '~A');"