Add a function to help parse PostgreSQL arrays
This commit is contained in:
parent
04bb2d52bc
commit
4710d4e398
1 changed files with 10 additions and 0 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
non-empty-string-or-false
|
non-empty-string-or-false
|
||||||
exec-query->vhash
|
exec-query->vhash
|
||||||
two-lists->vhash
|
two-lists->vhash
|
||||||
|
parse-postgresql-array-string
|
||||||
deduplicate-strings
|
deduplicate-strings
|
||||||
group-list-by-first-n-fields
|
group-list-by-first-n-fields
|
||||||
insert-missing-data-and-return-all-ids))
|
insert-missing-data-and-return-all-ids))
|
||||||
|
|
@ -47,6 +48,15 @@
|
||||||
l1
|
l1
|
||||||
l2))
|
l2))
|
||||||
|
|
||||||
|
(define (parse-postgresql-array-string s)
|
||||||
|
(if (string=? s "{}")
|
||||||
|
'()
|
||||||
|
(string-split
|
||||||
|
(string-drop-right
|
||||||
|
(string-drop s 1)
|
||||||
|
1)
|
||||||
|
#\,)))
|
||||||
|
|
||||||
(define (deduplicate-strings strings)
|
(define (deduplicate-strings strings)
|
||||||
(pair-fold
|
(pair-fold
|
||||||
(lambda (pair result)
|
(lambda (pair result)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue