Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
HCHogan committed Jul 31, 2024
1 parent ad4055a commit 77c9462
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 41 deletions.
157 changes: 141 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 32 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,49 @@ version = "0.1.0"
edition = "2021"

[dependencies]
salvo = { version = "0.68", features = [
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
mlua = { version = "0.9", features = ["lua54", "vendored", "serialize"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
const_format = "0.2"
clap = { version = "4", features = ["derive"] }
chrono = { version = "0.4", features = ["serde"] }
sonyflake = { version = "0.2.0" }
argon2 = "0.5"
color-eyre = "0.6"

[dependencies.salvo]
version = "0.68"
features = [
"oapi",
"anyhow",
"eyre",
"websocket",
"logging",
"basic-auth",
"compression",
"affix",
] }
]

sea-orm = { version = "1.0.0-rc.7", features = [
"debug-print",
[dependencies.sea-orm]
version = "1.0.0-rc.7"
features = [
"runtime-tokio",
"sqlx-postgres",
"debug-print",
"macros",
"with-uuid",
"with-json",
"with-chrono",
] }
]

tokio = { version = "1", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
mlua = { version = "0.9", features = ["lua54", "vendored", "serialize"] }
anyhow = "1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
const_format = "0.2"
clap = { version = "4", features = ["derive"] }
chrono = { version = "0.4", features = ["serde"] }
sonyflake = { version = "0.2.0"}
argon2 = "0.5"
[dependencies.sea-orm-migration]
version = "1.0.0-rc.7"
features = [
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
# View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime.
# e.g.
"runtime-tokio", # `ASYNC_RUNTIME` feature
"sqlx-postgres", # `DATABASE_DRIVER` feature
]
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use color_eyre::Result;
use mlua::{Lua, Table};
use serde::{Deserialize, Serialize};
use std::{env, path::Path};
Expand Down
9 changes: 6 additions & 3 deletions src/db.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use sea_orm::{Database, DatabaseConnection, DbErr};
use anyhow::Result;
use sea_orm::{ConnectOptions, Database, DatabaseConnection, DbErr};
use color_eyre::Result;
use tracing::info;

use crate::config::Config;
Expand All @@ -20,6 +20,9 @@ pub async fn init(config: &Config) -> Result<DatabaseConnection, DbErr> {
)
};

let mut opt = ConnectOptions::new(&db_url);
opt.sqlx_logging(true);

info!("Connecting to database at {}", db_url);
Database::connect(&db_url).await
Database::connect(opt).await
}
2 changes: 1 addition & 1 deletion src/handler/user_handler.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use color_eyre::Result;
use salvo::prelude::*;

use crate::models::user::{
Expand Down
Loading

0 comments on commit 77c9462

Please sign in to comment.