( items?: DatabaseSchemaItem[] )
| 31 | }); |
| 32 | |
| 33 | function generateAutoCompleteFromSchemaItems( |
| 34 | items?: DatabaseSchemaItem[] |
| 35 | ): Record<string, string[]> { |
| 36 | if (!items) return {}; |
| 37 | |
| 38 | return items |
| 39 | .filter((x) => x.type === "table" || x.type === "view") |
| 40 | .reduce( |
| 41 | (a, b) => { |
| 42 | a[b.name] = (b.tableSchema?.columns ?? []).map((c) => c.name); |
| 43 | return a; |
| 44 | }, |
| 45 | {} as Record<string, string[]> |
| 46 | ); |
| 47 | } |
| 48 | |
| 49 | export function generateAutoComplete( |
| 50 | currentSchemaName: string, |
no outgoing calls
no test coverage detected