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

Function extractDatabaseName

backend/api/mcp/tool_resolve.go:293–299  ·  view source on GitHub ↗

extractDatabaseName extracts the database name from a resource name like "instances/prod-pg/databases/employee_db".

(resourceName string)

Source from the content-addressed store, hash-verified

291
292// extractDatabaseName extracts the database name from a resource name like "instances/prod-pg/databases/employee_db".
293func extractDatabaseName(resourceName string) string {
294 parts := strings.Split(resourceName, "/")
295 if len(parts) >= 4 {
296 return parts[3]
297 }
298 return resourceName
299}
300
301// extractShortName extracts the last segment from a resource name like "instances/prod-pg" or "projects/hr-system".
302func extractShortName(resourceName string) string {

Callers 3

matchExactFunction · 0.70
matchCaseInsensitiveFunction · 0.70
matchSubstringFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected