Skip to content

Commit

Permalink
feat(shuttle-turso): change turso resource output type to database (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-mo-143 authored Apr 23, 2024
1 parent 5157708 commit 86ca0c0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 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::{Builder, Connection};
use libsql::{Builder, Database};
use serde::{Deserialize, Serialize};
use shuttle_service::{
error::{CustomError, Error as ShuttleError},
Expand Down Expand Up @@ -120,8 +120,8 @@ impl ResourceInputBuilder for Turso {
}

#[async_trait]
impl IntoResource<Connection> for TursoOutput {
async fn into_resource(self) -> Result<Connection, shuttle_service::Error> {
impl IntoResource<Database> for TursoOutput {
async fn into_resource(self) -> Result<Database, shuttle_service::Error> {
let database = if self.remote {
Builder::new_remote(
self.conn_url.to_string(),
Expand All @@ -136,10 +136,8 @@ impl IntoResource<Connection> for TursoOutput {
} else {
Builder::new_local(self.conn_url.to_string()).build().await
};
database
.map_err(|err| ShuttleError::Custom(err.into()))?
.connect()
.map_err(|err| ShuttleError::Custom(err.into()))

database.map_err(|err| ShuttleError::Custom(err.into()))
}
}

Expand Down

0 comments on commit 86ca0c0

Please sign in to comment.