Skip to content

Commit

Permalink
Add XML writer
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Jan 2, 2024
1 parent 0534511 commit 3a87a16
Show file tree
Hide file tree
Showing 12 changed files with 759 additions and 17 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ext-json": "*",
"ext-mbstring": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"ext-zlib": "*",
"composer-runtime-api": "^2.1",
"coduo/php-humanizer": "^4.0",
Expand All @@ -33,7 +34,8 @@
"psr/log": "^2.0 || ^3.0",
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0",
"symfony/console": "^6.3 || ^7.0",
"webmozart/glob": "^3.0 || ^4.0"
"webmozart/glob": "^3.0 || ^4.0",
"veewee/xml": "^2.13.0"
},
"require-dev": {
"aeon-php/calendar": "^1.0",
Expand Down
284 changes: 283 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function load(Rows $rows, FlowContext $context) : void
Row\Entry\DateTimeEntry::class => (int) $entry->value()->format('Uu'),
Row\Entry\UuidEntry::class => $entry->value()->toString(),
Row\Entry\EnumEntry::class => $entry->value()->name,
Row\Entry\XMLEntry::class => $entry->toString(),
default => $entry->value(),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Flow\ETL\Adapter\Parquet;

use Flow\ETL\Row\Entry\UuidEntry;
use Flow\ETL\Row\Entry\XMLEntry;
use Flow\ETL\Rows;

final class RowsNormalizer
Expand All @@ -20,6 +21,7 @@ public function normalize(Rows $rows) : array
foreach ($row->entries() as $entry) {
$columns[$entry->name()] = match ($entry::class) {
UuidEntry::class => $entry->value()->toString(),
XMLEntry::class => $entry->toString(),
default => $entry->value(),
};
}
Expand Down
4 changes: 3 additions & 1 deletion src/adapter/etl-adapter-xml/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"ext-dom": "*",
"ext-xmlreader": "*",
"flow-php/etl": "^0.5.0 || 1.x-dev"
"ext-xmlwriter": "*",
"flow-php/etl": "^0.5.0 || 1.x-dev",
"veewee/xml": "^2.13.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
Loading

0 comments on commit 3a87a16

Please sign in to comment.