diff options
author | Munyoki Kilyungi | 2023-07-03 13:49:39 +0300 |
---|---|---|
committer | BonfaceKilz | 2023-07-30 12:29:56 +0300 |
commit | ed440ac1c18058da9a0b7fa2cb62834f20f5d1ee (patch) | |
tree | ea39ec37f8a35b9407dc7a623e648ccfe0c3424f /dump/special-forms.scm | |
parent | 1b775aaefc9e2eaf5bfda62ec94856d7c10fce45 (diff) | |
download | gn-transform-databases-ed440ac1c18058da9a0b7fa2cb62834f20f5d1ee.tar.gz |
Add table-dump? option to dump-configuration record
* dump/special-forms.scm: Export dump-configuration-table-dump?.
(<dump-configuration>): Add dump-configuration-table-dump.
(dump-configuration): Make table-dump? default to #t.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'dump/special-forms.scm')
-rw-r--r-- | dump/special-forms.scm | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/dump/special-forms.scm b/dump/special-forms.scm index 0099f73..ded0db5 100644 --- a/dump/special-forms.scm +++ b/dump/special-forms.scm @@ -21,6 +21,7 @@ map-alist dump-configuration dump-configuration-table-metadata? + dump-configuration-table-dump? dump-configuration-auto-document-path define-dump)) @@ -28,10 +29,13 @@ (%dump-configuration table-metadata? auto-document-path) dump-configuration? (table-metadata? dump-configuration-table-metadata?) + (table-dump? dump-configuration-table-dump?) (auto-document-path dump-configuration-auto-document-path)) (define* (dump-configuration - #:optional (table-metadata? #f) + #:optional + (table-dump? #t) + (table-metadata? #f) (auto-document-path #f)) "Return a new configuration." (%dump-configuration table-metadata? auto-document-path)) @@ -441,30 +445,21 @@ must be remedied." #'(predicate-clauses ...)))) (when (dump-configuration-auto-document-path configuration) (for-each (match-lambda - ((predicate . object) - (format #f "Subject:~a Predicate:~a Object:~a.~%" - #,(car (collect-keys - (field->key #'subject))) - predicate object))) - (map-alist - '() - #,@(translate-forms 'field - (lambda (x) - (symbol->string - (syntax->datum - ((syntax-rules (field) - ((field (query alias)) alias) - ((field table column) column) - ((field table column alias) alias)) - x)))) - #'(predicate-clauses ...)) - ))) - (sql-for-each (lambda (row) - (scm->triples - (map-alist row #,@(field->key #'(predicate-clauses ...))) - #,(field->assoc-ref #'row #'subject))) - db - (select-query #,(collect-fields #'(subject predicate-clauses ...)) - (primary-table other-tables ...) - tables-raw ...))))) + ((predicate . object) + (format #f "Subject:~a Predicate:~a Object:~a.~%" + #,(car (collect-keys + (field->key #'subject))) + predicate object))) + (map-alist + '() + #,@(translate-forms 'field + (lambda (x) + (symbol->string + (syntax->datum + ((syntax-rules (field) + ((field (query alias)) alias) + ((field table column) column) + ((field table column alias) alias)) + x)))) + #'(predicate-clauses ...))))) (_ (error "Invalid define-dump syntax:" (syntax->datum x)))))) |