Rewrite doctests
This commit is contained in:
parent
f9d04fc73f
commit
7298fdeda9
@ -151,11 +151,11 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
||||||
/// # .append_exec_results(vec![
|
/// # .append_query_results(vec![
|
||||||
/// # MockExecResult {
|
/// # vec![cake::Model {
|
||||||
/// # last_insert_id: 15,
|
/// # id: 15,
|
||||||
/// # rows_affected: 1,
|
/// # name: "Apple Pie".to_owned(),
|
||||||
/// # },
|
/// # }],
|
||||||
/// # ])
|
/// # ])
|
||||||
/// # .into_connection();
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
@ -167,15 +167,13 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// apple
|
/// apple.insert(&db).await?,
|
||||||
/// .insert(&db)
|
/// cake::Model {
|
||||||
/// .await?,
|
/// id: 15,
|
||||||
/// cake::ActiveModel {
|
/// name: "Apple Pie".to_owned(),
|
||||||
/// id: Set(150),
|
|
||||||
/// name: Set("Apple Pie".to_owned()),
|
|
||||||
/// }
|
/// }
|
||||||
|
/// .into_active_model()
|
||||||
/// );
|
/// );
|
||||||
/// assert!(false);
|
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// db.into_transaction_log(),
|
/// db.into_transaction_log(),
|
||||||
@ -183,7 +181,8 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// DbBackend::Postgres,
|
/// DbBackend::Postgres,
|
||||||
/// r#"INSERT INTO "cake" ("name") VALUES ($1) RETURNING "id", "name""#,
|
/// r#"INSERT INTO "cake" ("name") VALUES ($1) RETURNING "id", "name""#,
|
||||||
/// vec!["Apple Pie".into()]
|
/// vec!["Apple Pie".into()]
|
||||||
/// )]);
|
/// )]
|
||||||
|
/// );
|
||||||
/// #
|
/// #
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
@ -199,6 +198,12 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let db = MockDatabase::new(DbBackend::MySql)
|
/// # let db = MockDatabase::new(DbBackend::MySql)
|
||||||
|
/// # .append_query_results(vec![
|
||||||
|
/// # vec![cake::Model {
|
||||||
|
/// # id: 15,
|
||||||
|
/// # name: "Apple Pie".to_owned(),
|
||||||
|
/// # }],
|
||||||
|
/// # ])
|
||||||
/// # .append_exec_results(vec![
|
/// # .append_exec_results(vec![
|
||||||
/// # MockExecResult {
|
/// # MockExecResult {
|
||||||
/// # last_insert_id: 15,
|
/// # last_insert_id: 15,
|
||||||
@ -215,13 +220,12 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// apple
|
/// apple.insert(&db).await?,
|
||||||
/// .insert(&db)
|
/// cake::Model {
|
||||||
/// .await?,
|
/// id: 15,
|
||||||
/// cake::ActiveModel {
|
/// name: "Apple Pie".to_owned(),
|
||||||
/// id: Set(150),
|
|
||||||
/// name: Set("Apple Pie".to_owned()),
|
|
||||||
/// }
|
/// }
|
||||||
|
/// .into_active_model()
|
||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
@ -235,7 +239,10 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// Transaction::from_sql_and_values(
|
/// Transaction::from_sql_and_values(
|
||||||
/// DbBackend::MySql,
|
/// DbBackend::MySql,
|
||||||
/// r#"SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` = ? LIMIT ?"#,
|
/// r#"SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` = ? LIMIT ?"#,
|
||||||
/// vec![15.into(), 1u64.into()])]);
|
/// vec![15.into(), 1u64.into()]
|
||||||
|
/// )
|
||||||
|
/// ]
|
||||||
|
/// );
|
||||||
/// #
|
/// #
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
@ -265,11 +272,12 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
||||||
/// # .append_exec_results(vec![
|
/// # .append_query_results(vec![
|
||||||
/// # MockExecResult {
|
/// # vec![fruit::Model {
|
||||||
/// # last_insert_id: 0,
|
/// # id: 1,
|
||||||
/// # rows_affected: 1,
|
/// # name: "Orange".to_owned(),
|
||||||
/// # },
|
/// # cake_id: None,
|
||||||
|
/// # }],
|
||||||
/// # ])
|
/// # ])
|
||||||
/// # .into_connection();
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
@ -282,14 +290,13 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// orange
|
/// orange.update(&db).await?,
|
||||||
/// .update(&db)
|
/// fruit::Model {
|
||||||
/// .await?,
|
/// id: 1,
|
||||||
/// fruit::ActiveModel {
|
/// name: "Orange".to_owned(),
|
||||||
/// id: Set(1),
|
/// cake_id: None,
|
||||||
/// name: Set("Orange".to_owned()),
|
|
||||||
/// cake_id: Set(None),
|
|
||||||
/// }
|
/// }
|
||||||
|
/// .into_active_model()
|
||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
@ -338,14 +345,13 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// orange
|
/// orange.update(&db).await?,
|
||||||
/// .update(&db)
|
/// fruit::Model {
|
||||||
/// .await?,
|
/// id: 1,
|
||||||
/// fruit::ActiveModel {
|
/// name: "Orange".to_owned(),
|
||||||
/// id: Set(1),
|
/// cake_id: None,
|
||||||
/// name: Set("Orange".to_owned()),
|
|
||||||
/// cake_id: Set(None),
|
|
||||||
/// }
|
/// }
|
||||||
|
/// .into_active_model()
|
||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
|
@ -285,12 +285,9 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
||||||
/// # .append_exec_results(vec![
|
/// # .append_query_results(vec![vec![maplit::btreemap! {
|
||||||
/// # MockExecResult {
|
/// # "id" => Into::<Value>::into(15),
|
||||||
/// # last_insert_id: 15,
|
/// # }]])
|
||||||
/// # rows_affected: 1,
|
|
||||||
/// # },
|
|
||||||
/// # ])
|
|
||||||
/// # .into_connection();
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
||||||
@ -302,8 +299,7 @@ pub trait EntityTrait: EntityName {
|
|||||||
///
|
///
|
||||||
/// let insert_result = cake::Entity::insert(apple).exec(&db).await?;
|
/// let insert_result = cake::Entity::insert(apple).exec(&db).await?;
|
||||||
///
|
///
|
||||||
/// assert_eq!(dbg!(insert_result.last_insert_id), 150);
|
/// assert_eq!(dbg!(insert_result.last_insert_id), 15);
|
||||||
/// assert!(false);
|
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// db.into_transaction_log(),
|
/// db.into_transaction_log(),
|
||||||
@ -311,7 +307,8 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// DbBackend::Postgres,
|
/// DbBackend::Postgres,
|
||||||
/// r#"INSERT INTO "cake" ("name") VALUES ($1) RETURNING "id""#,
|
/// r#"INSERT INTO "cake" ("name") VALUES ($1) RETURNING "id""#,
|
||||||
/// vec!["Apple Pie".into()]
|
/// vec!["Apple Pie".into()]
|
||||||
/// )]);
|
/// )]
|
||||||
|
/// );
|
||||||
/// #
|
/// #
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
@ -352,7 +349,8 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// DbBackend::MySql,
|
/// DbBackend::MySql,
|
||||||
/// r#"INSERT INTO `cake` (`name`) VALUES (?)"#,
|
/// r#"INSERT INTO `cake` (`name`) VALUES (?)"#,
|
||||||
/// vec!["Apple Pie".into()]
|
/// vec!["Apple Pie".into()]
|
||||||
/// )]);
|
/// )]
|
||||||
|
/// );
|
||||||
/// #
|
/// #
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
@ -376,12 +374,9 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
||||||
/// # .append_exec_results(vec![
|
/// # .append_query_results(vec![vec![maplit::btreemap! {
|
||||||
/// # MockExecResult {
|
/// # "id" => Into::<Value>::into(28),
|
||||||
/// # last_insert_id: 28,
|
/// # }]])
|
||||||
/// # rows_affected: 2,
|
|
||||||
/// # },
|
|
||||||
/// # ])
|
|
||||||
/// # .into_connection();
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
||||||
@ -395,7 +390,9 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// ..Default::default()
|
/// ..Default::default()
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// let insert_result = cake::Entity::insert_many(vec![apple, orange]).exec(&db).await?;
|
/// let insert_result = cake::Entity::insert_many(vec![apple, orange])
|
||||||
|
/// .exec(&db)
|
||||||
|
/// .await?;
|
||||||
///
|
///
|
||||||
/// assert_eq!(insert_result.last_insert_id, 28);
|
/// assert_eq!(insert_result.last_insert_id, 28);
|
||||||
///
|
///
|
||||||
@ -405,7 +402,8 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// DbBackend::Postgres,
|
/// DbBackend::Postgres,
|
||||||
/// r#"INSERT INTO "cake" ("name") VALUES ($1), ($2) RETURNING "id""#,
|
/// r#"INSERT INTO "cake" ("name") VALUES ($1), ($2) RETURNING "id""#,
|
||||||
/// vec!["Apple Pie".into(), "Orange Scone".into()]
|
/// vec!["Apple Pie".into(), "Orange Scone".into()]
|
||||||
/// )]);
|
/// )]
|
||||||
|
/// );
|
||||||
/// #
|
/// #
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
@ -440,7 +438,9 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// ..Default::default()
|
/// ..Default::default()
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// let insert_result = cake::Entity::insert_many(vec![apple, orange]).exec(&db).await?;
|
/// let insert_result = cake::Entity::insert_many(vec![apple, orange])
|
||||||
|
/// .exec(&db)
|
||||||
|
/// .await?;
|
||||||
///
|
///
|
||||||
/// assert_eq!(insert_result.last_insert_id, 28);
|
/// assert_eq!(insert_result.last_insert_id, 28);
|
||||||
///
|
///
|
||||||
@ -450,7 +450,8 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// DbBackend::MySql,
|
/// DbBackend::MySql,
|
||||||
/// r#"INSERT INTO `cake` (`name`) VALUES (?), (?)"#,
|
/// r#"INSERT INTO `cake` (`name`) VALUES (?), (?)"#,
|
||||||
/// vec!["Apple Pie".into(), "Orange Scone".into()]
|
/// vec!["Apple Pie".into(), "Orange Scone".into()]
|
||||||
/// )]);
|
/// )]
|
||||||
|
/// );
|
||||||
/// #
|
/// #
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
@ -477,11 +478,12 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
||||||
/// # .append_exec_results(vec![
|
/// # .append_query_results(vec![
|
||||||
/// # MockExecResult {
|
/// # vec![fruit::Model {
|
||||||
/// # last_insert_id: 0,
|
/// # id: 1,
|
||||||
/// # rows_affected: 1,
|
/// # name: "Orange".to_owned(),
|
||||||
/// # },
|
/// # cake_id: None,
|
||||||
|
/// # }],
|
||||||
/// # ])
|
/// # ])
|
||||||
/// # .into_connection();
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
@ -498,7 +500,12 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// .filter(fruit::Column::Name.contains("orange"))
|
/// .filter(fruit::Column::Name.contains("orange"))
|
||||||
/// .exec(&db)
|
/// .exec(&db)
|
||||||
/// .await?,
|
/// .await?,
|
||||||
/// orange
|
/// fruit::Model {
|
||||||
|
/// id: 1,
|
||||||
|
/// name: "Orange".to_owned(),
|
||||||
|
/// cake_id: None,
|
||||||
|
/// }
|
||||||
|
/// .into_active_model(),
|
||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
@ -523,6 +530,12 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let db = MockDatabase::new(DbBackend::MySql)
|
/// # let db = MockDatabase::new(DbBackend::MySql)
|
||||||
|
/// # .append_exec_results(vec![
|
||||||
|
/// # MockExecResult {
|
||||||
|
/// # last_insert_id: 0,
|
||||||
|
/// # rows_affected: 1,
|
||||||
|
/// # },
|
||||||
|
/// # ])
|
||||||
/// # .append_query_results(vec![
|
/// # .append_query_results(vec![
|
||||||
/// # vec![fruit::Model {
|
/// # vec![fruit::Model {
|
||||||
/// # id: 1,
|
/// # id: 1,
|
||||||
@ -530,12 +543,6 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// # cake_id: None,
|
/// # cake_id: None,
|
||||||
/// # }],
|
/// # }],
|
||||||
/// # ])
|
/// # ])
|
||||||
/// # .append_exec_results(vec![
|
|
||||||
/// # MockExecResult {
|
|
||||||
/// # last_insert_id: 0,
|
|
||||||
/// # rows_affected: 1,
|
|
||||||
/// # },
|
|
||||||
/// # ])
|
|
||||||
/// # .into_connection();
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
/// use sea_orm::{entity::*, query::*, tests_cfg::fruit};
|
/// use sea_orm::{entity::*, query::*, tests_cfg::fruit};
|
||||||
@ -551,7 +558,12 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// .filter(fruit::Column::Name.contains("orange"))
|
/// .filter(fruit::Column::Name.contains("orange"))
|
||||||
/// .exec(&db)
|
/// .exec(&db)
|
||||||
/// .await?,
|
/// .await?,
|
||||||
/// orange
|
/// fruit::Model {
|
||||||
|
/// id: 1,
|
||||||
|
/// name: "Orange".to_owned(),
|
||||||
|
/// cake_id: None,
|
||||||
|
/// }
|
||||||
|
/// .into_active_model(),
|
||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
@ -600,7 +612,12 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// # ])
|
/// # ])
|
||||||
/// # .into_connection();
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
/// use sea_orm::{entity::*, query::*, tests_cfg::fruit, sea_query::{Expr, Value}};
|
/// use sea_orm::{
|
||||||
|
/// entity::*,
|
||||||
|
/// query::*,
|
||||||
|
/// sea_query::{Expr, Value},
|
||||||
|
/// tests_cfg::fruit,
|
||||||
|
/// };
|
||||||
///
|
///
|
||||||
/// let update_result = fruit::Entity::update_many()
|
/// let update_result = fruit::Entity::update_many()
|
||||||
/// .col_expr(fruit::Column::CakeId, Expr::value(Value::Int(None)))
|
/// .col_expr(fruit::Column::CakeId, Expr::value(Value::Int(None)))
|
||||||
@ -616,7 +633,8 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// DbBackend::Postgres,
|
/// DbBackend::Postgres,
|
||||||
/// r#"UPDATE "fruit" SET "cake_id" = $1 WHERE "fruit"."name" LIKE $2"#,
|
/// r#"UPDATE "fruit" SET "cake_id" = $1 WHERE "fruit"."name" LIKE $2"#,
|
||||||
/// vec![Value::Int(None), "%Apple%".into()]
|
/// vec![Value::Int(None), "%Apple%".into()]
|
||||||
/// )]);
|
/// )]
|
||||||
|
/// );
|
||||||
/// #
|
/// #
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
@ -661,9 +679,11 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// assert_eq!(
|
/// assert_eq!(
|
||||||
/// db.into_transaction_log(),
|
/// db.into_transaction_log(),
|
||||||
/// vec![Transaction::from_sql_and_values(
|
/// vec![Transaction::from_sql_and_values(
|
||||||
/// DbBackend::Postgres, r#"DELETE FROM "fruit" WHERE "fruit"."id" = $1"#,
|
/// DbBackend::Postgres,
|
||||||
|
/// r#"DELETE FROM "fruit" WHERE "fruit"."id" = $1"#,
|
||||||
/// vec![3i32.into()]
|
/// vec![3i32.into()]
|
||||||
/// )]);
|
/// )]
|
||||||
|
/// );
|
||||||
/// #
|
/// #
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
@ -695,6 +715,12 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// # rows_affected: 5,
|
/// # rows_affected: 5,
|
||||||
/// # },
|
/// # },
|
||||||
/// # ])
|
/// # ])
|
||||||
|
/// # .append_query_results(vec![
|
||||||
|
/// # vec![cake::Model {
|
||||||
|
/// # id: 15,
|
||||||
|
/// # name: "Apple Pie".to_owned(),
|
||||||
|
/// # }],
|
||||||
|
/// # ])
|
||||||
/// # .into_connection();
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
/// use sea_orm::{entity::*, query::*, tests_cfg::fruit};
|
/// use sea_orm::{entity::*, query::*, tests_cfg::fruit};
|
||||||
@ -712,7 +738,8 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// DbBackend::Postgres,
|
/// DbBackend::Postgres,
|
||||||
/// r#"DELETE FROM "fruit" WHERE "fruit"."name" LIKE $1"#,
|
/// r#"DELETE FROM "fruit" WHERE "fruit"."name" LIKE $1"#,
|
||||||
/// vec!["%Apple%".into()]
|
/// vec!["%Apple%".into()]
|
||||||
/// )]);
|
/// )]
|
||||||
|
/// );
|
||||||
/// #
|
/// #
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
|
@ -96,14 +96,22 @@ where
|
|||||||
|
|
||||||
/// Fetch one page and increment the page counter
|
/// Fetch one page and increment the page counter
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use sea_orm::{error::*, tests_cfg::*, *};
|
/// # use sea_orm::{error::*, tests_cfg::*, *};
|
||||||
/// #
|
/// #
|
||||||
/// # #[smol_potat::main]
|
/// # #[smol_potat::main]
|
||||||
/// # #[cfg(feature = "mock")]
|
/// # #[cfg(feature = "mock")]
|
||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let owned_db = MockDatabase::new(DbBackend::Postgres).into_connection();
|
/// # let owned_db = MockDatabase::new(DbBackend::Postgres)
|
||||||
|
/// # .append_query_results(vec![
|
||||||
|
/// # vec![cake::Model {
|
||||||
|
/// # id: 1,
|
||||||
|
/// # name: "Cake".to_owned(),
|
||||||
|
/// # }],
|
||||||
|
/// # vec![],
|
||||||
|
/// # ])
|
||||||
|
/// # .into_connection();
|
||||||
/// # let db = &owned_db;
|
/// # let db = &owned_db;
|
||||||
/// #
|
/// #
|
||||||
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
||||||
@ -127,14 +135,22 @@ where
|
|||||||
|
|
||||||
/// Convert self into an async stream
|
/// Convert self into an async stream
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use sea_orm::{error::*, tests_cfg::*, *};
|
/// # use sea_orm::{error::*, tests_cfg::*, *};
|
||||||
/// #
|
/// #
|
||||||
/// # #[smol_potat::main]
|
/// # #[smol_potat::main]
|
||||||
/// # #[cfg(feature = "mock")]
|
/// # #[cfg(feature = "mock")]
|
||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let owned_db = MockDatabase::new(DbBackend::Postgres).into_connection();
|
/// # let owned_db = MockDatabase::new(DbBackend::Postgres)
|
||||||
|
/// # .append_query_results(vec![
|
||||||
|
/// # vec![cake::Model {
|
||||||
|
/// # id: 1,
|
||||||
|
/// # name: "Cake".to_owned(),
|
||||||
|
/// # }],
|
||||||
|
/// # vec![],
|
||||||
|
/// # ])
|
||||||
|
/// # .into_connection();
|
||||||
/// # let db = &owned_db;
|
/// # let db = &owned_db;
|
||||||
/// #
|
/// #
|
||||||
/// use futures::TryStreamExt;
|
/// use futures::TryStreamExt;
|
||||||
|
@ -637,7 +637,14 @@ where
|
|||||||
/// # #[cfg(feature = "mock")]
|
/// # #[cfg(feature = "mock")]
|
||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let db = MockDatabase::new(DbBackend::Postgres).into_connection();
|
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
||||||
|
/// # .append_query_results(vec![
|
||||||
|
/// # vec![cake::Model {
|
||||||
|
/// # id: 1,
|
||||||
|
/// # name: "Cake".to_owned(),
|
||||||
|
/// # }],
|
||||||
|
/// # ])
|
||||||
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
||||||
///
|
///
|
||||||
@ -681,7 +688,14 @@ where
|
|||||||
/// # #[cfg(feature = "mock")]
|
/// # #[cfg(feature = "mock")]
|
||||||
/// # pub async fn main() -> Result<(), DbErr> {
|
/// # pub async fn main() -> Result<(), DbErr> {
|
||||||
/// #
|
/// #
|
||||||
/// # let db = MockDatabase::new(DbBackend::Postgres).into_connection();
|
/// # let db = MockDatabase::new(DbBackend::Postgres)
|
||||||
|
/// # .append_query_results(vec![
|
||||||
|
/// # vec![cake::Model {
|
||||||
|
/// # id: 1,
|
||||||
|
/// # name: "Cake".to_owned(),
|
||||||
|
/// # }],
|
||||||
|
/// # ])
|
||||||
|
/// # .into_connection();
|
||||||
/// #
|
/// #
|
||||||
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
/// use sea_orm::{entity::*, query::*, tests_cfg::cake};
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user