Bump version to 0.1.4 and improve DatabaseConfig default implementation
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -747,7 +747,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "k-core"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "k-core"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
edition = "2024"
|
||||
|
||||
[features]
|
||||
|
||||
28
src/db.rs
28
src/db.rs
@@ -19,20 +19,24 @@ pub struct DatabaseConfig {
|
||||
impl Default for DatabaseConfig {
|
||||
fn default() -> Self {
|
||||
#[cfg(feature = "sqlite")]
|
||||
Self {
|
||||
url: "sqlite::memory:".to_string(),
|
||||
max_connections: 5,
|
||||
min_connections: 1,
|
||||
acquire_timeout: Duration::from_secs(30),
|
||||
};
|
||||
{
|
||||
Self {
|
||||
url: "sqlite::memory:".to_string(),
|
||||
max_connections: 5,
|
||||
min_connections: 1,
|
||||
acquire_timeout: Duration::from_secs(30),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(not(feature = "sqlite"), feature = "postgres"))]
|
||||
Self {
|
||||
url: "postgres://localhost:5432/mydb".to_string(),
|
||||
max_connections: 5,
|
||||
min_connections: 1,
|
||||
acquire_timeout: Duration::from_secs(30),
|
||||
};
|
||||
{
|
||||
Self {
|
||||
url: "postgres://localhost:5432/mydb".to_string(),
|
||||
max_connections: 5,
|
||||
min_connections: 1,
|
||||
acquire_timeout: Duration::from_secs(30),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(feature = "sqlite", feature = "postgres")))]
|
||||
Self {
|
||||
|
||||
Reference in New Issue
Block a user