/usr/share/guile/site/database/postgres-col-defs is in guile-pg 0.45-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 | (define-module(database postgres-col-defs)#:export(column-name type-name type-options validate-def objectifiers stringifiers)#:use-module((database postgres-types)#:select(dbcoltype-lookup dbcoltype:objectifier dbcoltype:stringifier)))
(define(column-name def)(car def))
(define(type-name def)(let((type-info(cdr def)))(if(pair? type-info)(car type-info)type-info)))
(define(type-options def)(let((type-info(cdr def)))(if(pair? type-info)(cdr type-info) '())))
(define (validate-def obj . typecheck)(or(and(pair? obj)(let((col-name(column-name obj)))(and(symbol? col-name)(let((s(symbol->string col-name)))(=(string-length s)(apply +(map(lambda(c)(if(char-whitespace? c)0 1))(string->list s)))))))(pair?(cdr obj))(let((col-type(type-name obj)))(and(symbol? col-type)(or(null? typecheck)((car typecheck)col-type)))))(error "malformed def:" obj)))
(define(objectifiers defs)(map dbcoltype:objectifier(map dbcoltype-lookup(map type-name defs))))
(define(stringifiers defs)(map dbcoltype:stringifier(map dbcoltype-lookup(map type-name defs))))
|