diff --git a/examples/sqlx-mysql/src/operation.rs b/examples/sqlx-mysql/src/operation.rs index 2eb95607..d7a5ed78 100644 --- a/examples/sqlx-mysql/src/operation.rs +++ b/examples/sqlx-mysql/src/operation.rs @@ -20,12 +20,12 @@ pub async fn insert_and_update(db: &DbConn) -> Result<(), ExecErr> { name: Set("pear".to_owned()), ..Default::default() }; - let res = Fruit::insert(pear).exec(db).await?; + let res: InsertResult = Fruit::insert(pear).exec(db).await?; println!(); - println!("Inserted: {:?}\n", res); + println!("Inserted: last_insert_id = {}\n", res.last_insert_id); - let pear = Fruit::find_by_id(res.last_insert_id) + let pear: Option = Fruit::find_by_id(res.last_insert_id) .one(db) .await .map_err(|_| ExecErr)?; @@ -36,10 +36,10 @@ pub async fn insert_and_update(db: &DbConn) -> Result<(), ExecErr> { let mut pear: fruit::ActiveModel = pear.unwrap().into(); pear.name = Set("Sweet pear".to_owned()); - let res = Fruit::update(pear).exec(db).await?; + let pear: fruit::ActiveModel = Fruit::update(pear).exec(db).await?; println!(); - println!("Updated: {:?}\n", res); + println!("Updated: {:?}\n", pear); Ok(()) } diff --git a/examples/sqlx-mysql/src/select.rs b/examples/sqlx-mysql/src/select.rs index 825efdab..6057671e 100644 --- a/examples/sqlx-mysql/src/select.rs +++ b/examples/sqlx-mysql/src/select.rs @@ -44,7 +44,7 @@ pub async fn all_about_select(db: &DbConn) -> Result<(), QueryErr> { async fn find_all(db: &DbConn) -> Result<(), QueryErr> { print!("find all cakes: "); - let cakes = Cake::find().all(db).await?; + let cakes: Vec = Cake::find().all(db).await?; println!(); for cc in cakes.iter() { @@ -105,7 +105,7 @@ async fn find_one(db: &DbConn) -> Result<(), QueryErr> { print!("find models belong to: "); - let fruits = cheese.find_fruit().all(db).await?; + let fruits = cheese.find_related(Fruit).all(db).await?; println!(); for ff in fruits.iter() { @@ -144,7 +144,7 @@ async fn count_fruits_by_cake(db: &DbConn) -> Result<(), QueryErr> { async fn find_many_to_many(db: &DbConn) -> Result<(), QueryErr> { print!("find cakes and fillings: "); - let both = Cake::find() + let both: Vec<(cake::Model, Vec)> = Cake::find() .left_join_and_select_with(Filling) .all(db) .await?; diff --git a/src/lib.rs b/src/lib.rs index 89b83a4d..273479d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,7 @@ mod driver; pub mod entity; mod executor; pub mod query; +#[doc(hidden)] pub mod tests_cfg; mod util;