aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-09-05 13:51:42 +0200
committerChristopher Baines <mail@cbaines.net>2019-09-05 16:07:23 +0200
commit2b5594e5d4861c1a5c40bb12e72124e714351f54 (patch)
treedf552b8047401c873915d656a9718971759e6b36 /guix-data-service/model
parent1a55022524043bdf2f120dd38990d42949ecb6e2 (diff)
downloaddata-service-2b5594e5d4861c1a5c40bb12e72124e714351f54.tar
data-service-2b5594e5d4861c1a5c40bb12e72124e714351f54.tar.gz
Support deleting duplicates in insert-missing-data-and-return-all-ids
This is useful when you want to pass in data with some duplicates, and get back a list of ids, where the duplicate entries are represented by the same id.
Diffstat (limited to 'guix-data-service/model')
-rw-r--r--guix-data-service/model/utils.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/guix-data-service/model/utils.scm b/guix-data-service/model/utils.scm
index e636988..f569080 100644
--- a/guix-data-service/model/utils.scm
+++ b/guix-data-service/model/utils.scm
@@ -77,7 +77,8 @@
fields
data
#:key
- sets-of-data?)
+ sets-of-data?
+ delete-duplicates?)
(define field-strings
(map symbol->string fields))
@@ -180,7 +181,9 @@
existing-entries)))
(if sets-of-data?
(delete-duplicates (concatenate data))
- data)))
+ (if delete-duplicates?
+ (delete-duplicates data)
+ data))))
(new-entries
(if (null? missing-entries)
'()