MCPcopy Create free account
hub / github.com/bytebase/bytebase / findTableMatches

Function findTableMatches

backend/api/mcp/tool_schema.go:461–473  ·  view source on GitHub ↗

findTableMatches returns every (schema, table) pair whose table name equals the requested name. The caller decides how to handle 0, 1, or multiple matches.

(metadata *databaseMetadata, table string)

Source from the content-addressed store, hash-verified

459// findTableMatches returns every (schema, table) pair whose table name equals
460// the requested name. The caller decides how to handle 0, 1, or multiple matches.
461func findTableMatches(metadata *databaseMetadata, table string) []tableMatch {
462 var matches []tableMatch
463 for i := range metadata.Schemas {
464 schema := &metadata.Schemas[i]
465 for j := range schema.Tables {
466 t := &schema.Tables[j]
467 if t.Name == table {
468 matches = append(matches, tableMatch{schema: schema.Name, table: t})
469 }
470 }
471 }
472 return matches
473}
474
475// lookupTableCandidates issues a second GetDatabaseMetadata call (no table filter)
476// to build a list of candidate table names for a TABLE_NOT_FOUND error.

Callers 1

renderTableResultMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected