init_database

Function init_database 

Source
pub fn init_database(name: &str) -> Result<()>
Expand description

Initializes a new SQLite database file.

This function creates a new database file at the specified path. It includes logic to:

  • Append .db if not present.
  • Check if the database already exists to prevent overwriting.
  • Create parent directories if they don’t exist.
  • Use a retry mechanism for creating the connection.
  • Verify the integrity of the newly created database.

§Arguments

  • name - The name of the database file to create.

§Returns

A Result which is Ok(()) on successful creation, or an Err with context if it fails.