Bump version to 0.1.4 and improve DatabaseConfig default implementation

This commit is contained in:
2026-01-02 13:40:45 +01:00
parent c783323b69
commit c70a1eb443
3 changed files with 18 additions and 14 deletions

2
Cargo.lock generated
View File

@@ -747,7 +747,7 @@ dependencies = [
[[package]] [[package]]
name = "k-core" name = "k-core"
version = "0.1.3" version = "0.1.4"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "k-core" name = "k-core"
version = "0.1.3" version = "0.1.4"
edition = "2024" edition = "2024"
[features] [features]

View File

@@ -19,20 +19,24 @@ pub struct DatabaseConfig {
impl Default for DatabaseConfig { impl Default for DatabaseConfig {
fn default() -> Self { fn default() -> Self {
#[cfg(feature = "sqlite")] #[cfg(feature = "sqlite")]
{
Self { Self {
url: "sqlite::memory:".to_string(), url: "sqlite::memory:".to_string(),
max_connections: 5, max_connections: 5,
min_connections: 1, min_connections: 1,
acquire_timeout: Duration::from_secs(30), acquire_timeout: Duration::from_secs(30),
}; }
}
#[cfg(all(not(feature = "sqlite"), feature = "postgres"))] #[cfg(all(not(feature = "sqlite"), feature = "postgres"))]
{
Self { Self {
url: "postgres://localhost:5432/mydb".to_string(), url: "postgres://localhost:5432/mydb".to_string(),
max_connections: 5, max_connections: 5,
min_connections: 1, min_connections: 1,
acquire_timeout: Duration::from_secs(30), acquire_timeout: Duration::from_secs(30),
}; }
}
#[cfg(not(any(feature = "sqlite", feature = "postgres")))] #[cfg(not(any(feature = "sqlite", feature = "postgres")))]
Self { Self {