Skip to content

Commit

Permalink
[Rust/Viz] viz v0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Oct 3, 2024
1 parent 85ff491 commit 0ae6a25
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
17 changes: 11 additions & 6 deletions frameworks/Rust/viz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,28 @@ path = "src/main_diesel.rs"
required-features = ["diesel", "diesel-async", "sailfish"]

[dependencies]
viz = "0.8"
hyper = "1.0"
viz = "0.9"
hyper = "1.4"
hyper-util = "0.1"
atoi = "2.0"
serde = { version = "1.0", features = ["derive"] }
nanorand = "0.7"
rand = { version = "0.8", features = ["small_rng"] }
thiserror = "1.0"
futures-util = "0.3"

[target.'cfg(not(unix))'.dependencies]
nanorand = { version = "0.7" }

[target.'cfg(unix)'.dependencies]
nanorand = { version = "0.7", features = ["getrandom"] }

tokio = { version = "1", features = ["full"] }
tokio-postgres = { version = "0.7", optional = true }
sqlx = { version = "0.7", features = [
sqlx = { version = "0.8", features = [
"postgres",
"macros",
"runtime-tokio",
"tls-native-tls"
"tls-native-tls",
], optional = true }
diesel = { version = "2.2", default-features = false, features = [
"i-implement-a-third-party-backend-and-opt-into-breaking-changes",
Expand All @@ -53,7 +58,7 @@ diesel-async = { git = "https://github.com/weiznich/diesel_async.git", rev = "74
yarte = { version = "0.15", features = ["bytes-buf", "json"], optional = true }
markup = { version = "0.15", optional = true }
v_htmlescape = { version = "0.15", optional = true }
sailfish = { version = "0.8", optional = true }
sailfish = { version = "0.9", optional = true }

[profile.release]
lto = true
Expand Down
6 changes: 3 additions & 3 deletions frameworks/Rust/viz/src/db_sqlx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub async fn get_world(
id: i32,
) -> Result<World, PgError> {
let mut args = PgArguments::default();
args.add(id);
args.add(id)?;

let world =
sqlx::query_as_with("SELECT id, randomnumber FROM World WHERE id = $1", args)
Expand All @@ -86,8 +86,8 @@ pub async fn update_worlds(

for w in &worlds {
let mut args = PgArguments::default();
args.add(w.randomnumber);
args.add(w.id);
args.add(w.randomnumber)?;
args.add(w.id)?;

sqlx::query_with("UPDATE World SET randomNumber = $1 WHERE id = $2", args)
.execute(&mut *conn)
Expand Down
4 changes: 2 additions & 2 deletions frameworks/Rust/viz/templates/fortune.stpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<body>
<table>
<tr><th>id</th><th>message</th></tr>
<% for item in items { %><tr><td><%= item.id %></td><td><%= &*item.message %></td></tr><% } %>
<% for item in self.items { %><tr><td><%= item.id %></td><td><%= &*item.message %></td></tr><% } %>
</table>
</body>
</html>
</html>

0 comments on commit 0ae6a25

Please sign in to comment.