Skip to content

Commit f45599a

Browse files
committed
Elimenate all references to spin-sqlite
Signed-off-by: Ryan Levick <[email protected]>
1 parent d59305b commit f45599a

File tree

7 files changed

+16
-40
lines changed

7 files changed

+16
-40
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/factor-sqlite/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ tokio = { version = "1", features = ["macros", "rt"] }
2929
default = ["spin-cli"]
3030
# Includes the runtime configuration handling used by the Spin CLI
3131
spin-cli = [
32-
"dep:spin-sqlite",
33-
"dep:spin-sqlite-inproc",
34-
"dep:spin-sqlite-libsql",
32+
"dep:spin-sqlite",
33+
"dep:spin-sqlite-inproc",
34+
"dep:spin-sqlite-libsql",
3535
]
3636

3737
[lints]

crates/factor-sqlite/src/runtime_config/spin.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::{
55
sync::Arc,
66
};
77

8+
use async_trait::async_trait;
89
use serde::Deserialize;
910
use spin_factors::{
1011
anyhow::{self, Context as _},
@@ -119,18 +120,18 @@ impl DefaultLabelResolver for RuntimeConfigResolver {
119120

120121
const DEFAULT_SQLITE_DB_FILENAME: &str = "sqlite_db.db";
121122

122-
#[async_trait::async_trait]
123+
#[async_trait]
123124
impl Connection for spin_sqlite_inproc::InProcConnection {
124125
async fn query(
125126
&self,
126127
query: &str,
127128
parameters: Vec<v2::Value>,
128129
) -> Result<v2::QueryResult, v2::Error> {
129-
<Self as spin_sqlite::Connection>::query(self, query, parameters).await
130+
self.query(query, parameters).await
130131
}
131132

132133
async fn execute_batch(&self, statements: &str) -> anyhow::Result<()> {
133-
<Self as spin_sqlite::Connection>::execute_batch(self, statements).await
134+
self.execute_batch(statements).await
134135
}
135136
}
136137

@@ -165,26 +166,20 @@ impl LibSqlConnection {
165166
}
166167
}
167168

168-
#[async_trait::async_trait]
169+
#[async_trait]
169170
impl Connection for LibSqlConnection {
170171
async fn query(
171172
&self,
172173
query: &str,
173174
parameters: Vec<v2::Value>,
174175
) -> Result<v2::QueryResult, v2::Error> {
175176
let client = self.get_client().await?;
176-
<spin_sqlite_libsql::LibsqlClient as spin_sqlite::Connection>::query(
177-
client, query, parameters,
178-
)
179-
.await
177+
client.query(query, parameters).await
180178
}
181179

182180
async fn execute_batch(&self, statements: &str) -> anyhow::Result<()> {
183181
let client = self.get_client().await?;
184-
<spin_sqlite_libsql::LibsqlClient as spin_sqlite::Connection>::execute_batch(
185-
client, statements,
186-
)
187-
.await
182+
client.execute_batch(statements).await
188183
}
189184
}
190185

crates/sqlite-inproc/src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use std::{
44
};
55

66
use anyhow::Context;
7-
use async_trait::async_trait;
87
use once_cell::sync::OnceCell;
9-
use spin_sqlite::Connection;
108
use spin_world::v2::sqlite;
119
use tracing::{instrument, Level};
1210

@@ -68,10 +66,9 @@ impl InProcConnection {
6866
}
6967
}
7068

71-
#[async_trait]
72-
impl Connection for InProcConnection {
69+
impl InProcConnection {
7370
#[instrument(name = "spin_sqlite_inproc.query", skip(self), err(level = Level::INFO), fields(otel.kind = "client", db.system = "sqlite", otel.name = query))]
74-
async fn query(
71+
pub async fn query(
7572
&self,
7673
query: &str,
7774
parameters: Vec<sqlite::Value>,
@@ -86,7 +83,7 @@ impl Connection for InProcConnection {
8683
}
8784

8885
#[instrument(name = "spin_sqlite_inproc.execute_batch", skip(self), err(level = Level::INFO), fields(otel.kind = "client", db.system = "sqlite", db.statements = statements))]
89-
async fn execute_batch(&self, statements: &str) -> anyhow::Result<()> {
86+
pub async fn execute_batch(&self, statements: &str) -> anyhow::Result<()> {
9087
let connection = self.db_connection()?;
9188
let statements = statements.to_owned();
9289
tokio::task::spawn_blocking(move || {

crates/sqlite-libsql/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ async-trait = "0.1.68"
1111
# libsqlite3-sys as used by spin-sqlite-inproc.
1212
libsql = { version = "0.3.2", features = ["remote"], default-features = false }
1313
rusqlite = { version = "0.29.0", features = ["bundled"] }
14-
spin-sqlite = { path = "../sqlite" }
1514
spin-world = { path = "../world" }
1615
sqlparser = "0.34"
1716
tokio = { version = "1", features = ["full"] }

crates/sqlite-libsql/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ impl LibsqlClient {
1515
}
1616
}
1717

18-
#[async_trait::async_trait]
19-
impl spin_sqlite::Connection for LibsqlClient {
18+
impl LibsqlClient {
2019
#[instrument(name = "spin_sqlite_libsql.query", skip(self), err(level = Level::INFO), fields(otel.kind = "client", db.system = "sqlite", otel.name = query))]
21-
async fn query(
20+
pub async fn query(
2221
&self,
2322
query: &str,
2423
parameters: Vec<sqlite::Value>,
@@ -38,7 +37,7 @@ impl spin_sqlite::Connection for LibsqlClient {
3837
}
3938

4039
#[instrument(name = "spin_sqlite_libsql.execute_batch", skip(self), err(level = Level::INFO), fields(otel.kind = "client", db.system = "sqlite", db.statements = statements))]
41-
async fn execute_batch(&self, statements: &str) -> anyhow::Result<()> {
40+
pub async fn execute_batch(&self, statements: &str) -> anyhow::Result<()> {
4241
self.inner.execute_batch(statements).await?;
4342

4443
Ok(())

crates/sqlite/src/lib.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
use spin_core::async_trait;
2-
use spin_world::v2::sqlite;
31

4-
/// A trait abstracting over operations to a SQLite database
5-
#[async_trait]
6-
pub trait Connection: Send + Sync {
7-
async fn query(
8-
&self,
9-
query: &str,
10-
parameters: Vec<sqlite::Value>,
11-
) -> Result<sqlite::QueryResult, sqlite::Error>;
12-
13-
async fn execute_batch(&self, statements: &str) -> anyhow::Result<()>;
14-
}

0 commit comments

Comments
 (0)