就先写到这了
This commit is contained in:
parent
0f06eb8107
commit
556958a38c
670
Cargo.lock
generated
670
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -2,5 +2,6 @@
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
members = [
|
members = [
|
||||||
"sr_download",
|
"sr_download",
|
||||||
"migration"
|
"migration",
|
||||||
|
"db_part"
|
||||||
]
|
]
|
||||||
|
13
db_part/Cargo.toml
Normal file
13
db_part/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "db_part"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = { version = "1.0.86", features = ["backtrace"] }
|
||||||
|
migration = { path = "../migration" }
|
||||||
|
sea-orm = {version = "0.12.15", features = [
|
||||||
|
"sqlx-postgres",
|
||||||
|
"runtime-tokio-rustls"
|
||||||
|
]}
|
||||||
|
tokio = { version = "1.38.1", features = ["full"] }
|
12
db_part/src/lib.rs
Normal file
12
db_part/src/lib.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
use anyhow::Ok;
|
||||||
|
use sea_orm::{ConnectOptions, Database, DatabaseConnection};
|
||||||
|
|
||||||
|
pub async fn init_db() -> anyhow::Result<()> {
|
||||||
|
let mut opt =
|
||||||
|
ConnectOptions::new("postgres://srdown:srdown@localhost:5432/srdown?currentSchema=srdown");
|
||||||
|
opt.max_connections(10).sqlx_logging(true);
|
||||||
|
|
||||||
|
let db = Database::connect(opt).await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
@ -6,7 +6,7 @@ use sea_orm_migration::prelude::*;
|
|||||||
pub struct Migration;
|
pub struct Migration;
|
||||||
|
|
||||||
#[derive(DeriveIden)]
|
#[derive(DeriveIden)]
|
||||||
struct SaveTypeEnum;
|
pub struct SaveTypeEnum;
|
||||||
|
|
||||||
#[derive(DeriveIden, EnumIter)]
|
#[derive(DeriveIden, EnumIter)]
|
||||||
pub enum SaveTypeVariants {
|
pub enum SaveTypeVariants {
|
||||||
|
Loading…
Reference in New Issue
Block a user