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

Function buildDatabaseFilter

backend/api/mcp/tool_resolve.go:65–75  ·  view source on GitHub ↗

buildDatabaseFilter builds a CEL filter expression for ListDatabases.

(database, instance, project string)

Source from the content-addressed store, hash-verified

63
64// buildDatabaseFilter builds a CEL filter expression for ListDatabases.
65func buildDatabaseFilter(database, instance, project string) string {
66 // name.contains does substring matching server-side.
67 filter := fmt.Sprintf("name.contains(%q)", database)
68 if instance != "" {
69 filter += fmt.Sprintf(" && instance == %q", "instances/"+instance)
70 }
71 if project != "" {
72 filter += fmt.Sprintf(" && project == %q", "projects/"+project)
73 }
74 return filter
75}
76
77// listDatabases lists databases matching the filter in the user's workspace.
78// Uses the workspace ID from the JWT token stored in context.

Callers 2

TestBuildDatabaseFilterFunction · 0.70
resolveDatabaseMethod · 0.70

Calls

no outgoing calls

Tested by 1

TestBuildDatabaseFilterFunction · 0.56