Next: Builtin Converters, Up: Octet Molding/Mashing [Contents][Index]
To see if a type is “known” to Guile-PG, use the type-registered?
procedure. Use type-foo
procs for particulars.
Return #t
if type (a symbol) has registered converters.
Return the stringifier for type (a symbol).
Return the objectifier for type (a symbol).
Return the default for type (a symbol).
Return the SQL name (a string) of type (a symbol).
Here is a simple example that uses type-objectifier
to convert
a two-dimensional text
array value into a nested list:
(let ((raw (pg-getvalue result 0 0)) (conv (type-objectifier '**text))) (format #t "~A~%~S~%" raw (conv raw))) -| {{a,b},{c,d}} -| (("a" "b") ("c" "d"))
Note that even though the type is an “array”, as implied by the leading asterisks, the result is a list. This is mostly due to a limitation in PostgreSQL: dimensionality is not stored for array types, so the conversion cannot be done in a random-access manner. Perhaps this will change in the future.