Skip to content

Commit a4a6b9e

Browse files
committed
Spin 3.4 SQLite and PostgreSQL interfaces
Signed-off-by: itowlson <[email protected]>
1 parent ebbc396 commit a4a6b9e

File tree

14 files changed

+1700
-47
lines changed

14 files changed

+1700
-47
lines changed

Cargo.lock

Lines changed: 211 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ anyhow = "1"
2121
async-trait = "0.1.74"
2222
chrono = "0.4.38"
2323
form_urlencoded = "1.0"
24+
rust_decimal = { version = "1.37.2", default-features = false }
2425
spin-executor = { version = "4.0.0", path = "crates/executor" }
2526
spin-macro = { version = "4.0.0", path = "crates/macro" }
2627
thiserror = "1.0.37"
@@ -33,6 +34,8 @@ hyperium = { package = "http", version = "1.0.0" }
3334
serde_json = { version = "1.0.96", optional = true }
3435
serde = { version = "1.0.163", optional = true }
3536
wasi = { workspace = true }
37+
uuid = "1.18.0"
38+
postgres_range = "0.11.1"
3639

3740
[features]
3841
default = ["export-sdk-language", "json"]

src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ mod test;
88
/// Key/Value storage.
99
pub mod key_value;
1010

11-
/// SQLite storage.
11+
/// SQLite storage for Spin 2 and earlier. Applications that do not require
12+
/// this backward compatibility should use the [`sqlite3`](crate::sqlite3) module instead.
1213
pub mod sqlite;
14+
/// SQLite storage.
15+
pub mod sqlite3;
1316

1417
/// Large Language Model (Serverless AI) APIs
1518
pub mod llm;
@@ -34,7 +37,9 @@ pub mod wit {
3437
generate_all,
3538
});
3639
pub use fermyon::spin2_0_0 as v2;
37-
pub use spin::postgres::postgres as pg3;
40+
pub use spin::postgres3_0_0::postgres as pg3;
41+
pub use spin::postgres4_0_0::postgres as pg4;
42+
pub use spin::sqlite::sqlite as sqlite3;
3843
}
3944

4045
#[export_name = concat!("spin-sdk-version-", env!("SDK_VERSION"))]
@@ -56,8 +61,8 @@ pub mod mqtt;
5661
pub mod redis;
5762

5863
pub mod pg;
59-
6064
pub mod pg3;
65+
pub mod pg4;
6166

6267
pub mod mysql;
6368

src/pg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//! Spin 2 Postgres relational database storage. Applications that do not require
2-
//! Spin 2 support should use the [`pg3`](crate::pg3) module instead.
1+
//! Postgres relational database storage for Spin 2 and earlier. Applications that do not require
2+
//! this backward compatibility should use the [`pg4`](crate::pg4) module instead.
33
//!
44
//! Conversions between Rust, WIT and **Postgres** types.
55
//!

src/pg3.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//! Postgres relational database storage.
1+
//! Postgres relational database storage for Spin 3.3 and earlier. Applications that do not require
2+
//! this backward compatibility should use the [`pg4`](crate::pg4) module instead.
23
//!
34
//! You can use the [`into()`](std::convert::Into) method to convert
45
//! a Rust value into a [`ParameterValue`]. You can use the

0 commit comments

Comments
 (0)