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

Function DatabaseExists

backend/plugin/advisor/utils.go:163–181  ·  view source on GitHub ↗
(ctx context.Context, checkCtx Context, database string)

Source from the content-addressed store, hash-verified

161}
162
163func DatabaseExists(ctx context.Context, checkCtx Context, database string) bool {
164 if checkCtx.ListDatabaseNamesFunc == nil {
165 return false
166 }
167
168 names, err := checkCtx.ListDatabaseNamesFunc(ctx, checkCtx.InstanceID)
169 if err != nil {
170 slog.Debug("failed to list databases", slog.String("instance", checkCtx.InstanceID), log.BBError(err))
171 return false
172 }
173
174 for _, name := range names {
175 if name == database {
176 return true
177 }
178 }
179
180 return false
181}

Callers 5

handleSQLScriptExitMethod · 0.92
CheckMethod · 0.92
CheckMethod · 0.92
CheckMethod · 0.92
CheckMethod · 0.92

Calls 4

BBErrorFunction · 0.92
ListDatabaseNamesFuncMethod · 0.80
DebugMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected