Files
Mikhail ChusavitinandClaude Opus 5 59e3107197 Add timeout, busy-state, parser-variant and build-freshness rules
- task-discipline: require explicit target platform/language before implementation
- go-api: bounded context deadline on every outbound network/DB call
- controls-selection: visible busy state for any control triggering such a call
- import-export: enumerate real format variants before writing a parser
- app-binary: embedded assets do not hot-reload; verify rebuild before diagnosing

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 21:00:42 +03:00
..

Import / Export Pattern Notes

This file keeps examples. The normative rules live in contract.md.

Export Handler Sketch

func ExportCSV(c *gin.Context) {
    c.Header("Content-Type", "text/csv; charset=utf-8")
    c.Header("Content-Disposition", `attachment; filename="export.csv"`)
    c.Writer.Write([]byte{0xEF, 0xBB, 0xBF})

    w := csv.NewWriter(c.Writer)
    w.Comma = ';'
    w.Write([]string{"ID", "Name", "Price"})

    err := svc.StreamRows(ctx, filters, func(row Row) error {
        return w.Write([]string{row.ID, row.Name, formatPrice(row.Price)})
    })
    w.Flush()
    if err != nil {
        slog.Error("csv export failed mid-stream", "err", err)
    }
}

Locale Notes

  • BOM avoids broken UTF-8 in Excel on Windows.
  • Semicolon avoids single-column imports in RU/EU locales.
  • Decimal comma keeps numbers numeric in Excel.
  • DD.MM.YYYY is preferred over ISO dates for user-facing spreadsheet exports.