Skip to content

Phase 4: Statement/Session separation (future consideration) #499

@apstndb

Description

@apstndb

Summary

Investigate whether separating statements and session into sub-packages is worthwhile.

Challenge

  • Execute methods take *Session directly
  • Session has ~30+ methods, making a SessionExecutor interface unwieldy
  • Interface bloat risk may outweigh the organizational benefit

Possible approaches

  1. Interface approach: Define narrow SessionExecutor interface — risk of interface being too large
  2. File naming convention: Keep in same package, use consistent file prefixes for logical grouping
  3. Partial extraction: Extract only statement types/definitions, keep execution in main package

Decision

This phase may not be necessary if file naming conventions provide sufficient organization. Evaluate after Phase 2-3 are complete.

Evaluation (post Phase 2-3)

Phase 2-3 completed:

  • internal/mycli/ reduced from ~97 to 80 files
  • 5 sub-packages extracted: decoder/, filesafety/, format/, metrics/, streamio/
  • sysvar/ extraction abandoned — unexported struct fields in CustomVar/EnumVar used in ~20 struct literals in var_registry.go make extraction impractical without exporting fields or adding constructors

Assessment

File naming conventions provide sufficient organization for now. The ~30+ methods on Session make interface extraction high-effort/low-value. Keeping this open as a future consideration if the package grows further or natural interface boundaries emerge.

Remaining extraction candidates (not blocking)

  • sysvar/ — blocked by unexported field access pattern; could revisit if var_registry.go is refactored
  • Result struct decomposition — not urgent, could be done incrementally via embedded structs

Prerequisites

Parent: #495

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions