aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model/lint-warning-message.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-09-04 19:24:22 +0200
committerChristopher Baines <mail@cbaines.net>2019-09-05 16:07:23 +0200
commitd3913a14d55968e505429693a6df6125e3468300 (patch)
tree8f051b7b8906685297308cb82ea1bcdf2a9eeffe /guix-data-service/model/lint-warning-message.scm
parent6c90fe432496a2b2ace6984ac24beb7f7736ef1c (diff)
downloaddata-service-d3913a14d55968e505429693a6df6125e3468300.tar
data-service-d3913a14d55968e505429693a6df6125e3468300.tar.gz
Start handling ids as numbers, rather than strings
squee, returns all data as strings, and expects strings as inputs to queries. So, keeping the ids as strings was easy initially, but it means that you can't tell from the type whether it should be quoted, or not... Therefore, handle ids as strings, converting them to numbers when they're fetched from the database, and back to strings as part of the queries.
Diffstat (limited to 'guix-data-service/model/lint-warning-message.scm')
-rw-r--r--guix-data-service/model/lint-warning-message.scm13
1 files changed, 7 insertions, 6 deletions
diff --git a/guix-data-service/model/lint-warning-message.scm b/guix-data-service/model/lint-warning-message.scm
index 7e54e41..85183a3 100644
--- a/guix-data-service/model/lint-warning-message.scm
+++ b/guix-data-service/model/lint-warning-message.scm
@@ -26,7 +26,7 @@
"('{"
(string-join
(map number->string
- (sort (map string->number lint-message-ids) <))
+ (sort lint-message-ids <))
", ")
"}')")
" RETURNING id")))
@@ -47,10 +47,11 @@
(string-append
"SELECT id FROM lint_warning_message_sets "
"WHERE message_ids = ARRAY["
- (string-join lint-warning-message-ids ", ")
+ (string-join (map number->string lint-warning-message-ids) ", ")
"]"))))
- (match lint-message-set-id
- (((id)) id)
- (()
- (insert-lint-warning-message-set conn lint-warning-message-ids)))))
+ (string->number
+ (match lint-message-set-id
+ (((id)) id)
+ (()
+ (insert-lint-warning-message-set conn lint-warning-message-ids))))))