Commit 08c9bb1
Fix Stringer types encoded as text instead of numeric value in composite fields
Named integer types implementing fmt.Stringer (e.g. protobuf enums) were
encoded using their String() output instead of their numeric value when used
inside composite type fields. This happened because TryWrapBuiltinTypeEncodePlan
matched fmt.Stringer before TryWrapFindUnderlyingTypeEncodePlan could convert
the type to its underlying integer.
Extract fmt.Stringer handling into a new TryWrapStringerEncodePlan function that
runs after TryWrapFindUnderlyingTypeEncodePlan. The wrapper loop's existing
"first successful recursive plan wins" semantics ensures the right behavior:
numeric codecs match for numeric OIDs, Stringer is used as fallback for text OIDs.
Fixes #2527
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 96b4dbd commit 08c9bb1
2 files changed
Lines changed: 80 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
52 | 113 | | |
53 | 114 | | |
54 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| |||
1446 | 1447 | | |
1447 | 1448 | | |
1448 | 1449 | | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
1449 | 1468 | | |
1450 | 1469 | | |
1451 | 1470 | | |
| |||
1506 | 1525 | | |
1507 | 1526 | | |
1508 | 1527 | | |
1509 | | - | |
1510 | | - | |
1511 | 1528 | | |
1512 | 1529 | | |
1513 | 1530 | | |
| |||
0 commit comments