Support of string keys.
This commit is contained in:
+7
-2
@@ -3,6 +3,7 @@
|
||||
(require racket/contract
|
||||
racket/serialize
|
||||
racket/port
|
||||
racket/string
|
||||
db
|
||||
)
|
||||
|
||||
@@ -184,10 +185,14 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define (value->string v)
|
||||
(if (string? v)
|
||||
v
|
||||
(call-with-output-string
|
||||
(λ (out) (write (serialize v) out))))
|
||||
(λ (out) (write (serialize v) out)))))
|
||||
|
||||
(define (string->value v)
|
||||
(if (and (string-prefix? v "((") (string-suffix? v ")"))
|
||||
(deserialize
|
||||
(call-with-input-string v (λ (in) (read in)))))
|
||||
(call-with-input-string v (λ (in) (read in))))
|
||||
v))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user