diff options
author | Christopher Baines <mail@cbaines.net> | 2019-05-16 22:27:47 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-05-16 22:27:47 +0100 |
commit | d52f5b530f079ec7d2efbab81ddf31eca90b584f (patch) | |
tree | 0d9b1cc4a27490bffccd0b50ed2b082e01cda87c | |
parent | 26cdf5568f6ab9efb5177ab2e87d6bccd026e122 (diff) | |
download | data-service-d52f5b530f079ec7d2efbab81ddf31eca90b584f.tar data-service-d52f5b530f079ec7d2efbab81ddf31eca90b584f.tar.gz |
Add support to multi-value fields with defaults
To the query parameters module.
-rw-r--r-- | guix-data-service/web/query-parameters.scm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/guix-data-service/web/query-parameters.scm b/guix-data-service/web/query-parameters.scm index 66edb64..7445409 100644 --- a/guix-data-service/web/query-parameters.scm +++ b/guix-data-service/web/query-parameters.scm @@ -135,6 +135,20 @@ (() #f) (x (cons name x)))) + ((name processor #:multi-value #:default default) + (match (filter-map + (match-lambda + ((k . value) + (and + (eq? k name) + (match value + (#f #f) + ("" #f) + (value (processor value)))))) + request-query-parameters) + (() (cons name default)) + (x (cons name x)))) + ((name processor #:default default) (match (assq name request-query-parameters) (#f (cons name default)) |