Skip to content

Commit

Permalink
Merge pull request #40 from libsql/lucio/fix-more-feature-flags
Browse files Browse the repository at this point in the history
Fix more feature flags, bump worker version
  • Loading branch information
psarna authored Aug 10, 2023
2 parents 9f6289c + ca3a698 commit 6633894
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@cargo-hack
- name: Check
run: cargo check --all-targets --all-features
- name: Clippy
Expand All @@ -24,3 +25,5 @@ jobs:
run: cargo test --verbose
- name: Run example
run: cargo run --example select
- name: Check features
run: cargo hack check --all --ignore-private --each-feature --no-dev-deps
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ url = "2.3.1"
base64 = "0.21.0"
num-traits = "0.2.15"
serde_json = "1.0.91"
worker = { version = "0.0.12", optional = true }
worker = { version = "0.0.18", optional = true }
spin-sdk = { version = "1.4", git = "https://github.com/fermyon/spin", tag = "v1.4.1", default-features = false, optional = true }
sqlite3-parser = { version = "0.8.0", default-features = false, features = [ "YYNOERRORRECOVERY" ] }
http = { version = "0.2", optional = true }
Expand Down
9 changes: 9 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub enum Client {
Http(crate::http::Client),
#[cfg(feature = "hrana_backend")]
Hrana(crate::hrana::Client),
Default,
}

/// A synchronous flavor of [Client]. All its public methods are synchronous,
Expand Down Expand Up @@ -65,6 +66,7 @@ impl Client {
Self::Http(r) => r.raw_batch(stmts).await,
#[cfg(feature = "hrana_backend")]
Self::Hrana(h) => h.raw_batch(stmts).await,
_ => panic!("Must enable atleast one feature"),
}
}

Expand Down Expand Up @@ -186,6 +188,7 @@ impl Client {
Self::Http(r) => r.execute(stmt).await,
#[cfg(feature = "hrana_backend")]
Self::Hrana(h) => h.execute(stmt).await,
_ => panic!("Must enable atleast one feature"),
}
}

Expand Down Expand Up @@ -224,6 +227,8 @@ impl Client {
Self::Http(r) => r.execute_in_transaction(tx_id, stmt).await,
#[cfg(feature = "hrana_backend")]
Self::Hrana(h) => h.execute_in_transaction(tx_id, stmt).await,

_ => panic!("Must enable atleast one feature"),
}
}

Expand All @@ -239,6 +244,8 @@ impl Client {
Self::Http(r) => r.commit_transaction(tx_id).await,
#[cfg(feature = "hrana_backend")]
Self::Hrana(h) => h.commit_transaction(tx_id).await,

_ => panic!("Must enable atleast one feature"),
}
}

Expand All @@ -254,6 +261,8 @@ impl Client {
Self::Http(r) => r.rollback_transaction(tx_id).await,
#[cfg(feature = "hrana_backend")]
Self::Hrana(h) => h.rollback_transaction(tx_id).await,

_ => panic!("Must enable atleast one feature"),
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub enum InnerClient {
Workers(crate::workers::HttpClient),
#[cfg(feature = "spin_backend")]
Spin(crate::spin::HttpClient),
Default,
}

impl InnerClient {
Expand All @@ -47,6 +48,7 @@ impl InnerClient {
InnerClient::Workers(client) => client.send(url, auth, body).await,
#[cfg(feature = "spin_backend")]
InnerClient::Spin(client) => client.send(url, auth, body).await,
_ => panic!("Must enable atleast one feature"),
}
}
}
Expand Down

0 comments on commit 6633894

Please sign in to comment.