Show Databases
Show Databases
Description:
Displays all databases currently registered in the in-memory catalog. The function reads database metadata from the loaded catalog and prints the database names to the console.
Function:
pub fn show_databases(catalog: &Catalog)
Input:
catalog— Read-only reference to the in-memory catalog containing database metadata.
Output:
- No return value (
()). - Prints the list of database names to the console.
- If no databases exist, prints:
No databases found.
Implementation:
- Log a header indicating that database information is being displayed.
- Check whether
catalog.databasesis empty. - If no databases exist:
- Log the message.
- Print
"No databases found.". - Return immediately.
- Iterate through all keys in:
catalog.databases - Print each database name to the console.
- Log the displayed database names.
Internal API Calls:
-
catalog.databases.is_empty()- Checks whether any databases are registered in the catalog.
-
catalog.databases.keys()- Retrieves all database names stored in the catalog.
-
log::debug!(...)- Writes debug information to the logging system.
-
log::info!(...)- Writes informational messages to the logging system.
-
println!(...)- Displays database names to the user.
Files Created/Modified:
- None.
Catalog Updates:
- None.
- The function is read-only and does not modify catalog metadata.