tableNameMatches returns true if `name` is a plausible candidate for a typo of `missing`. A name matches if it contains the input as a (case-insensitive) substring, or if it shares a sufficiently long common prefix (useful for typos like "orderz" → "orders", "order_items").
(name, missing string)
| 501 | // substring, or if it shares a sufficiently long common prefix (useful for typos |
| 502 | // like "orderz" → "orders", "order_items"). |
| 503 | func tableNameMatches(name, missing string) bool { |
| 504 | n := strings.ToLower(name) |
| 505 | m := strings.ToLower(missing) |
| 506 | if m == "" { |
| 507 | return false |
| 508 | } |
| 509 | if strings.Contains(n, m) { |
| 510 | return true |
| 511 | } |
| 512 | // Require a shared prefix of at least 4 chars (or the full input if shorter). |
| 513 | prefixLen := min(4, len(m)) |
| 514 | if len(n) < prefixLen { |
| 515 | return false |
| 516 | } |
| 517 | return n[:prefixLen] == m[:prefixLen] |
| 518 | } |
| 519 | |
| 520 | // transformSchemas converts decoded metadata into the response shape for the |
| 521 | // given include level. Applies sorting and per-schema truncation. |
no outgoing calls
no test coverage detected