Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 14 additions & 58 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ thiserror = "2.0"
tokio = { version = "1" }
tokio-postgres = "0.7"
tokio-test = { version = "0.4" }
turso = "0.3"
turso_core = { version = "0.3", default-features = false, features = ["fs"] }
url = "2.5"
uuid = "1.2"

Expand Down
1 change: 1 addition & 0 deletions butane/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ debug = ["butane_core/debug"]
log = ["butane_core/log"]
r2d2 = ["dep:r2d2"]
turso = ["butane_core/turso"]
turso-async = ["async", "async-adapter", "butane_core/turso-async"]
tls = ["butane_core/tls"]
uuid = ["butane_codegen/uuid", "butane_core/uuid"]
# This feature is for testing only. It will delete the .butane directory inside the butane crate, which only
Expand Down
17 changes: 12 additions & 5 deletions butane_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@ rust-version.workspace = true

[features]
default = ["fs"]
async-adapter = ["async", "crossbeam-channel"]
async-adapter = ["crossbeam-channel"]
async = ["tokio"]
datetime = ["chrono", "tokio-postgres?/with-chrono-0_4"]
datetime = ["chrono", "tokio-postgres?/with-chrono-0_4", "turso_core?/time"]
debug = ["log"]
fake = ["dep:fake", "rand"]
fs = ["dep:fs2"]
json = ["tokio-postgres?/with-serde_json-1", "rusqlite?/serde_json"]
json = ["tokio-postgres?/with-serde_json-1", "rusqlite?/serde_json", "turso_core?/json"]
log = ["dep:log", "rusqlite?/trace"]
pg = ["async", "bytes", "tokio-postgres"]
rusqlite = ["dep:rusqlite"]
sqlite = ["rusqlite"]
sqlite-bundled = ["rusqlite/bundled"]
tls = ["native-tls", "postgres-native-tls"]
turso = ["async", "dep:turso"]
turso = ["dep:turso_core"]
turso-async = ["turso", "async", "async-adapter"]
uuid = ["dep:uuid"]

[dependencies]
async-trait = { workspace = true}
Expand Down Expand Up @@ -58,7 +61,7 @@ serde_json = { workspace = true }
sqlparser = { workspace = true }
syn = { workspace = true }
thiserror = { workspace = true }
turso = { workspace = true, optional = true }
turso_core = { workspace = true, optional = true, features = ["serde", "fs", "uuid"] }
url.workspace = true
uuid = { workspace = true, optional = true }

Expand All @@ -75,6 +78,10 @@ tokio = { workspace = true, features = ["macros"] }
uuid.workspace = true
whoami = "1.6"

[[test]]
name = "autopk"
required-features = ["async"]

[[test]]
name = "uuid"
required-features = ["uuid"]
16 changes: 16 additions & 0 deletions butane_core/src/db/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ pub(crate) trait PlaceholderSource {
fn next_placeholder(&mut self) -> Cow<'_, str>;
}

/// Placeholder source for databases that use `?` as a placeholder (SQLite, Turso).
#[derive(Debug)]
pub(crate) struct QuestionMarkPlaceholderSource;

impl QuestionMarkPlaceholderSource {
pub(crate) fn new() -> Self {
QuestionMarkPlaceholderSource {}
}
}

impl PlaceholderSource for QuestionMarkPlaceholderSource {
fn next_placeholder(&mut self) -> Cow<'_, str> {
Cow::Borrowed("?")
}
}

/// Quotes the `word` if it is a reserved word.
pub fn quote_reserved_word(word: &str) -> Cow<'_, str> {
if sqlparser::keywords::ALL_KEYWORDS.contains(&word.to_uppercase().as_str()) {
Expand Down
2 changes: 1 addition & 1 deletion butane_core/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ mod macros;
#[cfg(feature = "pg")]
pub mod pg;

#[cfg(feature = "sqlite")]
#[cfg(any(feature = "sqlite", feature = "turso"))]
pub mod sqlite;

/// Turso database backend.
Expand Down
Loading
Loading