parseEnumValuesWithRename parses enum values from DDL and extracts @renamed annotations. It looks for patterns like: 'value' /* @renamed from=old_value */ or 'value' -- @renamed from=old_value
(ddl string, rawValues []string, mode GeneratorMode)
| 1166 | // parseEnumValuesWithRename parses enum values from DDL and extracts @renamed annotations. |
| 1167 | // It looks for patterns like: 'value' /* @renamed from=old_value */ or 'value' -- @renamed from=old_value |
| 1168 | func parseEnumValuesWithRename(ddl string, rawValues []string, mode GeneratorMode) []EnumValue { |
| 1169 | result := make([]EnumValue, len(rawValues)) |
| 1170 | for i, value := range rawValues { |
| 1171 | result[i] = EnumValue{value: value} |
| 1172 | } |
| 1173 | |
| 1174 | // Extract comments using tokenizer-based approach |
| 1175 | valueComments := extractEnumValueComments(ddl, mode) |
| 1176 | |
| 1177 | // Match comments to enum values |
| 1178 | for i, value := range rawValues { |
| 1179 | if comment, exists := valueComments[value]; exists { |
| 1180 | result[i].renamedFrom = extractRenameFrom(comment) |
| 1181 | } |
| 1182 | } |
| 1183 | return result |
| 1184 | } |
| 1185 | |
| 1186 | // extractEnumValueComments extracts inline comments from a CREATE TYPE ... AS ENUM statement |
| 1187 | // and maps them to enum values |
no test coverage detected