Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update libsql dep #1694

Merged
merged 3 commits into from
Mar 25, 2024
Merged
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
2 changes: 1 addition & 1 deletion resources/turso/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ keywords = ["shuttle-service", "turso"]
[dependencies]
async-trait = "0.1.56"
dunce = "1.0.4"
libsql = { version = "0.2.0", default-features = false, features = ["core", "remote"] }
libsql = { version = "0.3.1", default-features = false, features = ["core", "remote"] }
serde = { version = "1", features = ["derive"] }
shuttle-service = { path = "../../service", version = "0.42.0" }
url = { version = "2.3.1", features = ["serde"] }
Expand Down
8 changes: 5 additions & 3 deletions resources/turso/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use libsql::{Connection, Database};
use libsql::{Builder, Connection};
use serde::{Deserialize, Serialize};
use shuttle_service::{
error::{CustomError, Error as ShuttleError},
Expand Down Expand Up @@ -123,16 +123,18 @@ impl ResourceInputBuilder for Turso {
impl IntoResource<Connection> for TursoOutput {
async fn into_resource(self) -> Result<Connection, shuttle_service::Error> {
let database = if self.remote {
Database::open_remote(
Builder::new_remote(
self.conn_url.to_string(),
self.token
.clone()
.ok_or(ShuttleError::Custom(CustomError::msg(
"missing token for remote database",
)))?,
)
.build()
.await
} else {
Database::open(self.conn_url.to_string())
Builder::new_local(self.conn_url.to_string()).build().await
};
database
.map_err(|err| ShuttleError::Custom(err.into()))?
Expand Down