Summary
The SQL template renderer generates two local variables in every method body:
var sb strings.Builder
_params := make([]any, 0, N)
Two issues:
_params — The leading _ is the Go blank identifier. Using it as a prefix for an actively-used variable is misleading. It suggests the variable is discarded when it's actually central to the method.
sb — Too terse for a variable used across 20+ lines. A builder for a SQL query string deserves a clearer name.
Proposed
var buf strings.Builder
params := make([]any, 0, N)
Or alternatively query instead of buf since it's building a SQL query string.
Root Cause
internal/gen/sqlparser.go — RenderSQLTemplate emits var sb strings.Builder and _params := make(...) literally
- Also referenced in
internal/gen/template.go method body templates
Affected
All generated output. The hardcoded names in the SQL template renderer need updating, plus any test golden files that match these strings.
Summary
The SQL template renderer generates two local variables in every method body:
Two issues:
_params— The leading_is the Go blank identifier. Using it as a prefix for an actively-used variable is misleading. It suggests the variable is discarded when it's actually central to the method.sb— Too terse for a variable used across 20+ lines. A builder for a SQL query string deserves a clearer name.Proposed
Or alternatively
queryinstead ofbufsince it's building a SQL query string.Root Cause
internal/gen/sqlparser.go—RenderSQLTemplateemitsvar sb strings.Builderand_params := make(...)literallyinternal/gen/template.gomethod body templatesAffected
All generated output. The hardcoded names in the SQL template renderer need updating, plus any test golden files that match these strings.