Skip to content

refactor: extract format abstraction and modularize source #145

@vmvarela

Description

@vmvarela

Summary

Introduce src/format.zig as the canonical module for format types and output dispatch, and decompose the 2308-line main.zig god file into focused modules.

Motivation

main.zig mixes CLI parsing, business logic, SQL DDL, loading orchestration, and output dispatch. Adding a new format currently requires touching 6+ places in main.zig. The goal is to reduce that to: create one new file + register in one place.

Phases

  • Phase 1 (this issue): Create src/format.zig with InputFormat, OutputFormat, ColumnType, LoadOpts, WriteOpts, and OutputWriter. Migrate execQuery to use OutputWriter.
  • Phase 2: Reorganize into src/formats/ and src/modes/ subdirectories.
  • Phase 3: Consolidate sqlite.zig helpers (eliminate duplicates with main.zig).
  • Phase 4: Extract loader.zig to unify the 4 duplicated CSV-loading loops.
  • Phase 5: Move integration tests out of build.zig.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumShould be done soonsize:lLarge — 1 to 2 daystype:choreMaintenance, refactoring, tooling

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions