(ctx context.Context, checkCtx Context, database string)
| 161 | } |
| 162 | |
| 163 | func 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 | } |
no test coverage detected