瀏覽代碼

[viz] deps updates (#8406)

* [viz] deps updates

* chore(rust): lock rust version
Fangdun Tsai 2 年之前
父節點
當前提交
108d21959c

+ 15 - 14
frameworks/Rust/viz/Cargo.toml

@@ -24,34 +24,35 @@ path = "src/main_diesel.rs"
 required-features = ["diesel", "diesel-async", "sailfish"]
 
 [dependencies]
-viz = "0.4.10"
-hyper = "0.14.25"
+viz = "0.4"
+hyper = "0.14"
 atoi = "2.0"
 serde = { version = "1.0", features = ["derive"] }
 nanorand = "0.7"
-rand = { version = "0.8.5", features = ["small_rng"] }
+rand = { version = "0.8", features = ["small_rng"] }
 thiserror = "1.0"
-futures-util = "0.3.27"
+futures-util = "0.3"
 
-tokio = { version = "1.27", features = ["full"] }
-tokio-postgres = { version = "0.7.8", optional = true }
-sqlx = { version = "0.6.3", features = [
+tokio = { version = "1", features = ["full"] }
+tokio-postgres = { version = "0.7", optional = true }
+sqlx = { version = "0.7", features = [
   "postgres",
   "macros",
-  "runtime-tokio-native-tls",
+  "runtime-tokio",
+  "tls-native-tls"
 ], optional = true }
-diesel = { version = "2.0.3", default-features = false, features = [
+diesel = { version = "2.0", default-features = false, features = [
   "i-implement-a-third-party-backend-and-opt-into-breaking-changes",
 ], optional = true }
-diesel-async = { version = "0.2.1", default-features = false, features = [
+diesel-async = { version = "0.4", default-features = false, features = [
   "postgres",
   "bb8",
 ], optional = true }
 
-yarte = { version = "0.15.7", features = ["bytes-buf", "json"], optional = true }
-markup = { version = "0.13.1", optional = true }
-v_htmlescape = { version = "0.15.8", optional = true }
-sailfish = { version = "0.6.0", optional = true }
+yarte = { version = "0.15", features = ["bytes-buf", "json"], optional = true }
+markup = { version = "0.13", optional = true }
+v_htmlescape = { version = "0.15", optional = true }
+sailfish = { version = "0.8", optional = true }
 
 [profile.release]
 lto = true

+ 9 - 7
frameworks/Rust/viz/src/db_sqlx.rs

@@ -4,8 +4,8 @@ use nanorand::{Rng, WyRand};
 
 pub use sqlx::{
     pool::PoolConnection,
-    postgres::{PgArguments, PgPool, PgPoolOptions, PgRow},
-    Arguments, Pool, Postgres, Row,
+    postgres::{PgArguments, PgPoolOptions, PgRow},
+    Arguments, PgPool, Postgres, Row
 };
 
 use viz::{
@@ -66,10 +66,12 @@ pub async fn get_world(
     conn: &mut PoolConnection<Postgres>,
     id: i32,
 ) -> Result<World, PgError> {
+    let mut args = PgArguments::default();
+    args.add(id);
+
     let world =
-        sqlx::query_as::<_, World>("SELECT id, randomnumber FROM World WHERE id = $1")
-            .bind(id)
-            .fetch_one(conn)
+        sqlx::query_as_with("SELECT id, randomnumber FROM World WHERE id = $1", args)
+            .fetch_one(&mut **conn)
             .await?;
     Ok(world)
 }
@@ -95,7 +97,7 @@ pub async fn update_worlds(
         args.add(w.id);
 
         sqlx::query_with("UPDATE World SET randomNumber = $1 WHERE id = $2", args)
-            .execute(&mut conn)
+            .execute(&mut *conn)
             .await?;
     }
 
@@ -110,7 +112,7 @@ pub async fn get_fortunes(
             id: row.get(0),
             message: Cow::Owned(row.get(1)),
         })
-        .fetch_all(&mut conn)
+        .fetch_all(&mut *conn)
         .await?;
 
     items.push(Fortune {

+ 1 - 1
frameworks/Rust/viz/viz-diesel.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.66.0
+FROM rust:1.72
 
 RUN apt-get update -yqq && apt-get install -yqq cmake g++
 

+ 1 - 1
frameworks/Rust/viz/viz-pg.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.66.0
+FROM rust:1.72
 
 RUN apt-get update -yqq && apt-get install -yqq cmake g++
 

+ 1 - 1
frameworks/Rust/viz/viz-sqlx.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.66.0
+FROM rust:1.72
 
 RUN apt-get update -yqq && apt-get install -yqq cmake g++
 

+ 1 - 1
frameworks/Rust/viz/viz.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.66.0
+FROM rust:1.72
 
 RUN apt-get update -yqq && apt-get install -yqq cmake g++