Skip to content

Commit b5a4726

Browse files
committed
Fixed doc links
1 parent a8c8a6a commit b5a4726

3 files changed

Lines changed: 18 additions & 30 deletions

File tree

src/migrate/config.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ use anyhow::Context;
77
use rorm_declaration::config::DatabaseConfig;
88
use serde::{Deserialize, Serialize};
99

10-
/**
11-
Outer wrapper for the database configuration file.
12-
*/
10+
/// Outer wrapper for the database configuration file.
1311
#[derive(Serialize, Deserialize, Debug, Clone)]
1412
#[serde(rename_all = "PascalCase")]
1513
pub struct DatabaseConfigFile {
@@ -61,9 +59,7 @@ mod test {
6159
}
6260
}
6361

64-
/**
65-
Helper method to create a dummy database configuration file
66-
*/
62+
/// Helper method to create a dummy database configuration file
6763
pub(crate) fn create_db_config(path: &Path) -> anyhow::Result<()> {
6864
let fh = File::create(path).with_context(|| format!("Couldn't open {path:?} for writing"))?;
6965

@@ -74,11 +70,9 @@ pub(crate) fn create_db_config(path: &Path) -> anyhow::Result<()> {
7470
Ok(())
7571
}
7672

77-
/**
78-
Helper method to deserialize an existing database configuration file
79-
80-
`path`: [&Path]: Path to the configuration file
81-
*/
73+
/// Helper method to deserialize an existing database configuration file
74+
///
75+
/// - `path`: [`&Path`](Path): Path to the configuration file
8276
pub fn deserialize_db_conf(path: &Path) -> anyhow::Result<DatabaseConfig> {
8377
let db_conf_toml =
8478
read_to_string(path).with_context(|| "Couldn't read database configuration file")?;

src/migrate/mod.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ use crate::utils::migrations::get_existing_migrations;
1919
pub mod config;
2020
pub mod sql_builder;
2121

22-
/**
23-
Options for running migrations
24-
*/
22+
/// Options for running migrations
2523
pub struct MigrateOptions {
2624
/// Directory, migrations exist in
2725
pub migration_dir: String,
@@ -36,21 +34,19 @@ pub struct MigrateOptions {
3634
pub apply_until: Option<u16>,
3735
}
3836

39-
/**
40-
Helper method to apply one migration. Writes also to last migration table.
41-
42-
`migration`: [&Migration]: Reference to the migration to apply.
43-
`pool`: [&SqlitePool]: Pool to apply the migration onto.
44-
`last_migration_table_name`: [&str]: Name of the table to insert successful applied migrations into.
45-
*/
37+
/// Helper method to apply one migration. Writes also to last migration table.
38+
///
39+
/// - `migration`: [`&Migration`](Migration): Reference to the migration to apply.
40+
/// - `db`: [`&Database`](Database): Database to apply the migration onto.
41+
/// - `last_migration_table_name`: [`&str`]: Name of the table to insert successful applied migrations into.
4642
pub async fn apply_migration(
4743
dialect: DBImpl,
4844
migration: &Migration,
49-
pool: &Database,
45+
db: &Database,
5046
last_migration_table_name: &str,
5147
do_log: bool,
5248
) -> anyhow::Result<()> {
53-
let mut tx = pool
49+
let mut tx = db
5450
.start_transaction()
5551
.await
5652
.with_context(|| format!("Error while starting transaction {}", migration.id))?;
@@ -72,7 +68,7 @@ pub async fn apply_migration(
7268
println!("{query_string}");
7369
}
7470

75-
pool.execute::<Nothing>(query_string, bind_params).await.with_context(|| {
71+
db.execute::<Nothing>(query_string, bind_params).await.with_context(|| {
7672
format!(
7773
"Error while inserting applied migration {last_migration_table_name} into last migration table",
7874
)

src/migrate/sql_builder.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ use rorm_sql::drop_table::DropTable;
77
use rorm_sql::value::Value;
88
use rorm_sql::DBImpl;
99

10-
/**
11-
Helper method to convert a migration to a transaction string
12-
13-
`db_impl`: [DBImpl]: The database implementation to use.
14-
`migration`: [&Migration]: Reference to the migration that should be converted.
15-
*/
10+
/// Helper method to convert a migration to a transaction string
11+
///
12+
/// - `db_impl`: [`DBImpl`]: The database implementation to use.
13+
/// - `migration`: [`&Migration`](Migration): Reference to the migration that should be converted.
1614
pub async fn migration_to_sql<'a>(
1715
tx: &'a mut Transaction,
1816
db_impl: DBImpl,

0 commit comments

Comments
 (0)