Repository navigation
Commit 2d60910
committed
Dedupe sqlc.arg parameters wrapped in a type cast for MySQL
When a sqlc.arg() call was wrapped in a CAST (or MySQL's synthetic
MATCH...AGAINST type cast), the resulting Parameter was not marked as
named. Downstream struct-field generation then added numeric suffixes
to disambiguate identical names, producing spurious fields like
SearchTerm_3 alongside SearchTerm.
Capture the isNamed result from FetchMerge so the column correctly
reflects that it came from a named parameter, letting the code
generator reuse a single struct field for repeated sqlc.arg(name)
references.
Fixes #43761 parent 3f41c61 commit 2d60910
5 files changed
Lines changed: 43 additions & 2 deletions
File tree
- internal
- compiler
- endtoend/testdata/params_duplicate/mysql
- go
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
| 516 | + | |
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
| 520 | + | |
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
0 commit comments