normalizeType converts SQLite type declarations to standard type names
(declType string)
| 336 | |
| 337 | // normalizeType converts SQLite type declarations to standard type names |
| 338 | func normalizeType(declType string) string { |
| 339 | if declType == "" { |
| 340 | return "any" |
| 341 | } |
| 342 | |
| 343 | // Convert to lowercase for comparison |
| 344 | lower := strings.ToLower(declType) |
| 345 | |
| 346 | // SQLite type affinity rules (https://www.sqlite.org/datatype3.html) |
| 347 | switch { |
| 348 | case strings.Contains(lower, "int"): |
| 349 | return "integer" |
| 350 | case strings.Contains(lower, "char"), |
| 351 | strings.Contains(lower, "clob"), |
| 352 | strings.Contains(lower, "text"): |
| 353 | return "text" |
| 354 | case strings.Contains(lower, "blob"): |
| 355 | return "blob" |
| 356 | case strings.Contains(lower, "real"), |
| 357 | strings.Contains(lower, "floa"), |
| 358 | strings.Contains(lower, "doub"): |
| 359 | return "real" |
| 360 | case strings.Contains(lower, "bool"): |
| 361 | return "boolean" |
| 362 | case strings.Contains(lower, "date"), |
| 363 | strings.Contains(lower, "time"): |
| 364 | return "datetime" |
| 365 | default: |
| 366 | // Return as-is for numeric or other types |
| 367 | return lower |
| 368 | } |
| 369 | } |
no outgoing calls