mirror of
https://github.com/actix/examples
synced 2025-06-28 18:00:37 +02:00
Fix/suppress warnings
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
use r2d2;
|
||||
use r2d2_mysql::mysql::{Opts, OptsBuilder};
|
||||
use r2d2_mysql::MysqlConnectionManager;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
use juniper;
|
||||
use mysql::{from_row, params, Error as DBError, Row};
|
||||
|
||||
use crate::schemas::root::Context;
|
||||
|
@ -1,4 +1,3 @@
|
||||
use juniper;
|
||||
use juniper::{FieldError, FieldResult, RootNode};
|
||||
use mysql::{from_row, params, Error as DBError, Row};
|
||||
|
||||
@ -109,9 +108,9 @@ impl MutationRoot {
|
||||
let insert: Result<Option<Row>, DBError> = conn.first_exec(
|
||||
"INSERT INTO user(id, name, email) VALUES(:id, :name, :email)",
|
||||
params! {
|
||||
"id" => &new_id.to_owned(),
|
||||
"name" => &user.name.to_owned(),
|
||||
"email" => &user.email.to_owned(),
|
||||
"id" => &new_id,
|
||||
"name" => &user.name,
|
||||
"email" => &user.email,
|
||||
},
|
||||
);
|
||||
|
||||
@ -141,9 +140,9 @@ impl MutationRoot {
|
||||
let insert: Result<Option<Row>, DBError> = conn.first_exec(
|
||||
"INSERT INTO product(id, user_id, name, price) VALUES(:id, :user_id, :name, :price)",
|
||||
params! {
|
||||
"id" => &new_id.to_owned(),
|
||||
"user_id" => &product.user_id.to_owned(),
|
||||
"name" => &product.name.to_owned(),
|
||||
"id" => &new_id,
|
||||
"user_id" => &product.user_id,
|
||||
"name" => &product.name,
|
||||
"price" => &product.price.to_owned(),
|
||||
},
|
||||
);
|
||||
|
@ -1,4 +1,3 @@
|
||||
use juniper;
|
||||
use mysql::{from_row, params};
|
||||
|
||||
use crate::schemas::product::Product;
|
||||
@ -33,7 +32,8 @@ impl User {
|
||||
|
||||
fn products(&self, context: &Context) -> Vec<Product> {
|
||||
let mut conn = context.dbpool.get().unwrap();
|
||||
let products = conn
|
||||
|
||||
conn
|
||||
.prep_exec(
|
||||
"select * from product where user_id=:user_id",
|
||||
params! {
|
||||
@ -54,7 +54,6 @@ impl User {
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
.unwrap();
|
||||
products
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user