Skip to content

Commit

Permalink
Merge branch 'main' into better-clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
connortsui20 authored Nov 9, 2024
2 parents 6c208b6 + d15a7e2 commit 9f1c124
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
1 change: 0 additions & 1 deletion optd-persistent/Cargo.lock

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

1 change: 0 additions & 1 deletion optd-persistent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ trait-variant = "0.1.2"
async-trait = "0.1.43"
async-stream = "0.3.1"
strum = "0.26.1"
lazy_static = "1"
27 changes: 13 additions & 14 deletions optd-persistent/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(dead_code)]

use std::sync::atomic::AtomicUsize;
use std::{cell::LazyCell, sync::atomic::AtomicUsize};

use sea_orm::*;
use sea_orm_migration::prelude::*;
Expand All @@ -17,19 +17,18 @@ pub const DATABASE_FILENAME: &str = "sqlite.db";
pub const DATABASE_URL: &str = "sqlite:./sqlite.db?mode=rwc";

pub const TEST_DATABASE_FILENAME: &str = "init.db";
lazy_static::lazy_static! {
pub static ref TEST_DATABASE_FILE: String = {
std::env::current_dir().unwrap()
.join("src")
.join("db")
.join(TEST_DATABASE_FILENAME)
.to_str()
.unwrap()
.to_owned()
};
pub static ref TEST_DATABASE_URL: String =
get_sqlite_url(TEST_DATABASE_FILE.as_str());
}
pub const TEST_DATABASE_FILE: LazyCell<String> = LazyCell::new(|| {
std::env::current_dir()
.unwrap()
.join("src")
.join("db")
.join(TEST_DATABASE_FILENAME)
.to_str()
.unwrap()
.to_owned()
});
pub const TEST_DATABASE_URL: LazyCell<String> =
LazyCell::new(|| get_sqlite_url(TEST_DATABASE_FILE.as_str()));

fn get_sqlite_url(file: &str) -> String {
format!("sqlite:{}?mode=rwc", file)
Expand Down

0 comments on commit 9f1c124

Please sign in to comment.