1
0
mirror of https://github.com/actix/examples synced 2024-12-18 00:13:57 +01:00

bump uuid to v1

This commit is contained in:
Rob Ede 2022-07-31 23:51:08 +01:00
parent 9adb5d3f0e
commit 0149e64c7a
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 5 additions and 4 deletions

3
Cargo.lock generated
View File

@ -3225,7 +3225,7 @@ dependencies = [
"r2d2_mysql", "r2d2_mysql",
"serde", "serde",
"serde_json", "serde_json",
"uuid 0.8.2", "uuid 1.1.2",
] ]
[[package]] [[package]]
@ -6795,6 +6795,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f"
dependencies = [ dependencies = [
"getrandom 0.2.7", "getrandom 0.2.7",
"serde",
] ]
[[package]] [[package]]

View File

@ -19,4 +19,4 @@ env_logger = "0.9"
log = "0.4" log = "0.4"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
uuid = { version = "0.8", features = ["serde", "v4"] } uuid = { version = "1", features = ["v4", "serde"] }

View File

@ -93,7 +93,7 @@ pub struct MutationRoot;
impl MutationRoot { impl MutationRoot {
fn create_user(context: &Context, user: UserInput) -> FieldResult<User> { fn create_user(context: &Context, user: UserInput) -> FieldResult<User> {
let mut conn = context.db_pool.get().unwrap(); let mut conn = context.db_pool.get().unwrap();
let new_id = uuid::Uuid::new_v4().to_simple().to_string(); let new_id = uuid::Uuid::new_v4().simple().to_string();
let insert: Result<Option<Row>, DBError> = conn.exec_first( let insert: Result<Option<Row>, DBError> = conn.exec_first(
"INSERT INTO user(id, name, email) VALUES(:id, :name, :email)", "INSERT INTO user(id, name, email) VALUES(:id, :name, :email)",
@ -125,7 +125,7 @@ impl MutationRoot {
fn create_product(context: &Context, product: ProductInput) -> FieldResult<Product> { fn create_product(context: &Context, product: ProductInput) -> FieldResult<Product> {
let mut conn = context.db_pool.get().unwrap(); let mut conn = context.db_pool.get().unwrap();
let new_id = uuid::Uuid::new_v4().to_simple().to_string(); let new_id = uuid::Uuid::new_v4().simple().to_string();
let insert: Result<Option<Row>, DBError> = conn.exec_first( let insert: Result<Option<Row>, DBError> = conn.exec_first(
"INSERT INTO product(id, user_id, name, price) VALUES(:id, :user_id, :name, :price)", "INSERT INTO product(id, user_id, name, price) VALUES(:id, :user_id, :name, :price)",