Skip to content

Commit c4c2678

Browse files
author
Faycal Bououza
committed
Introduce new YAML exporter
1 parent a4311f4 commit c4c2678

File tree

6 files changed

+115
-980
lines changed

6 files changed

+115
-980
lines changed

cmd/root.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ var (
3838

3939
var rootCmd = &cobra.Command{
4040
Use: "pgxport",
41-
Short: "Export PostgreSQL query results to CSV, JSON, XML, or SQL formats",
41+
Short: "Export PostgreSQL query results to CSV, JSON, XML, YAML or SQL formats",
4242
Long: `A powerful CLI tool to export PostgreSQL query results.
4343
It supports direct SQL queries or SQL files, with customizable output options.
4444
4545
Supported output formats:
4646
• CSV — standard text export with customizable delimiter
4747
• JSON — structured export for API or data processing
4848
• XML — hierarchical export for interoperability
49+
• YAML — human-readable structured export for configs and tools
4950
• SQL — generate INSERT statements`,
5051
Example: ` # Export with inline query
5152
pgxport -s "SELECT * FROM users" -o users.csv
@@ -62,6 +63,9 @@ Supported output formats:
6263
# Export to XML
6364
pgxport -s "SELECT * FROM orders" -o orders.xml -f xml
6465
66+
# Export to YAML
67+
pgxport -s "SELECT * FROM user" -o orders.yml -f yaml
68+
6569
# Export to SQL insert statements
6670
pgxport -s "SELECT * FROM orders" -o orders.sql -f sql -t orders_table`,
6771
RunE: runExport,
@@ -277,14 +281,14 @@ func validateExportParams() error {
277281

278282
// Validate time format if provided
279283
if timeFormat != "" {
280-
if err := exporters.ValidateTimeFormat(timeFormat); err != nil {
284+
if err := validation.ValidateTimeFormat(timeFormat); err != nil {
281285
return fmt.Errorf("error: Invalid time format '%s'. Use format like 'yyyy-MM-dd HH:mm:ss'", timeFormat)
282286
}
283287
}
284288

285289
// Validate timezone if provided
286290
if timeZone != "" {
287-
if err := exporters.ValidateTimeZone(timeZone); err != nil {
291+
if err := validation.ValidateTimeZone(timeZone); err != nil {
288292
return fmt.Errorf("error: Invalid timezone '%s'. Use format like 'UTC' or 'Europe/Paris'", timeZone)
289293
}
290294
}

core/exporters/formatting.go

Lines changed: 0 additions & 327 deletions
This file was deleted.

0 commit comments

Comments
 (0)