We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hi im new in using rust iron and diesel and i'm doing a sample project i got using rust iron with r2d2 diesel cli mysql..... heres the error.
error[E0308]: mismatched types --> src/dal/models/user.rs:82:23 | 82 | Ok(new_user) => Ok(new_user), | ^^^^^^^^ expected struct dal::models::user::User, found usize | = note: expected type dal::models::user::User found type usize
dal::models::user::User
usize
error[E0308]: mismatched types --> src/dal/models/post.rs:36:23 | 36 | Ok(new_post) => Ok(new_post), | ^^^^^^^^ expected struct dal::models::post::Post, found usize | = note: expected type dal::models::post::Post found type usize
dal::models::post::Post
heres the code...
pub fn create(user: &NewUser, connection: &DieselConnection, logger: &Logger) -> Result<User, diesel::result::Error> { let statement = diesel::insert(user) .into(users::table); info!(logger, "Executing Query"; "query" => debug_sql!(statement), "user" => format!("{:?}", user)); let new_user = statement.execute(&**connection); //<User> match new_user { Ok(new_user) => Ok(new_user), Err(error) => { warn!(logger, "Error creating user"; o!("error" => format!("{:?}", error))); Err(error) }, } }
help me please im newbie.
The text was updated successfully, but these errors were encountered:
execute returns the number of affected rows. For mysql there is no way that an insertstatment returns the inserted row, this needs a distinct query.
execute
Sorry, something went wrong.
is there a work around to get the last_insert_id or let new_user = statement.get_result::(&**connection); in mysql diesel sir..
See http://docs.diesel.rs/diesel/macro.sql_function.html to use custom SQL functions.
No branches or pull requests
hi im new in using rust iron and diesel and i'm doing a sample project i got using rust iron with r2d2 diesel cli mysql..... heres the error.
error[E0308]: mismatched types
--> src/dal/models/user.rs:82:23
|
82 | Ok(new_user) => Ok(new_user),
| ^^^^^^^^ expected struct
dal::models::user::User
, found usize|
= note: expected type
dal::models::user::User
found type
usize
error[E0308]: mismatched types
--> src/dal/models/post.rs:36:23
|
36 | Ok(new_post) => Ok(new_post),
| ^^^^^^^^ expected struct
dal::models::post::Post
, found usize|
= note: expected type
dal::models::post::Post
found type
usize
heres the code...
help me please im newbie.
The text was updated successfully, but these errors were encountered: