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]]
|
[[package]]
|
||||||
name = "k-core"
|
name = "k-core"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|||||||
@@ -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]
|
||||||
|
|||||||
28
src/db.rs
28
src/db.rs
@@ -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 {
|
{
|
||||||
url: "sqlite::memory:".to_string(),
|
Self {
|
||||||
max_connections: 5,
|
url: "sqlite::memory:".to_string(),
|
||||||
min_connections: 1,
|
max_connections: 5,
|
||||||
acquire_timeout: Duration::from_secs(30),
|
min_connections: 1,
|
||||||
};
|
acquire_timeout: Duration::from_secs(30),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(all(not(feature = "sqlite"), feature = "postgres"))]
|
#[cfg(all(not(feature = "sqlite"), feature = "postgres"))]
|
||||||
Self {
|
{
|
||||||
url: "postgres://localhost:5432/mydb".to_string(),
|
Self {
|
||||||
max_connections: 5,
|
url: "postgres://localhost:5432/mydb".to_string(),
|
||||||
min_connections: 1,
|
max_connections: 5,
|
||||||
acquire_timeout: Duration::from_secs(30),
|
min_connections: 1,
|
||||||
};
|
acquire_timeout: Duration::from_secs(30),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(any(feature = "sqlite", feature = "postgres")))]
|
#[cfg(not(any(feature = "sqlite", feature = "postgres")))]
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user