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

feat(driver-adapters): enable Wasm on sql-query-connector #4444

Merged
merged 33 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
61ef25b
feat(quaint): allow wasm32-unknown-unknown compilation; currently fai…
jkomyno Nov 10, 2023
055e696
feat(quaint): split postgres connector into native and wasm submodules
jkomyno Nov 10, 2023
12c6ebb
feat(quaint): split mysql connector into native and wasm submodules
jkomyno Nov 10, 2023
060486d
feat(quaint): recover wasm error for mysql
jkomyno Nov 10, 2023
5de1dc0
feat(quaint): split mssql connector into native and wasm submodules
jkomyno Nov 10, 2023
8ecbc5c
feat(quaint): split sqlite connector into native and wasm submodules
jkomyno Nov 13, 2023
45df24f
chore(quaint): fix clippy when compiling natively
jkomyno Nov 13, 2023
6a1f733
chore(quaint): fix clippy when compiling to wasm32-unknown-unknown
jkomyno Nov 13, 2023
e61bf75
chore(quaint): update README
jkomyno Nov 13, 2023
257c4c8
chore(quaint): rename "*-connector" feature flag to "*-native"
jkomyno Nov 14, 2023
5ab6d96
feat(quaint): enable pure Wasm SqliteError
jkomyno Nov 14, 2023
ab65c95
feat(query-connect): allow wasm32-unknown-unknown compilation
jkomyno Nov 14, 2023
485f6dc
Merge branch 'main' into feat/quaint-on-wasm32-unknown-unknown
jkomyno Nov 14, 2023
cfb5507
feat(sql-query-connector): allow wasm32-unknown-unknown compilation
jkomyno Nov 14, 2023
e7df5a3
chore(query-engine-wasm): add currently unused local crates to test w…
jkomyno Nov 14, 2023
8c5d3dc
chore: update Cargo.lock
jkomyno Nov 14, 2023
6648a88
chore: remove leftover comments
jkomyno Nov 14, 2023
fe2fb8b
chore(sql-query-connector): fix clipppy on wasm32
jkomyno Nov 14, 2023
2ffe394
Merge branch 'feat/sql-query-connector-on-wasm32-unknown-unknown' of …
jkomyno Nov 14, 2023
c987dce
WIP: refactor mysql module to flatten its structure
miguelff Nov 15, 2023
626bc1e
feat(quaint): flatten mssql connector module
jkomyno Nov 15, 2023
a9f8ba8
feat(quaint): flatten postgres connector module
jkomyno Nov 15, 2023
3c1a100
feat(quaint): flatten sqlite connector module
jkomyno Nov 15, 2023
7f4c8f9
chore(quaint): export all public definitions in connector "url" modules
jkomyno Nov 15, 2023
95a4e28
chore(quaint): refactor tests for connectors, addressing feedback
jkomyno Nov 15, 2023
bacb635
chore: add comment on MysqlAsyncError
jkomyno Nov 15, 2023
263bab0
chore: add comment on ffi.rs for sqlite
jkomyno Nov 15, 2023
414ae2b
Merge branch 'feat/quaint-on-wasm32-unknown-unknown' into feat/sql-qu…
jkomyno Nov 15, 2023
76816fd
chore: replace awkward "super::super::" with "crate::..."
jkomyno Nov 15, 2023
7359a08
Merge branch 'feat/sql-query-connector-on-wasm32-unknown-unknown' of …
jkomyno Nov 15, 2023
33cdf77
Merge branch 'main' into feat/sql-query-connector-on-wasm32-unknown-u…
jkomyno Nov 17, 2023
3541054
fix(driver-adapters): ci for "request-handlers"
jkomyno Nov 17, 2023
e79cb1f
Merge branch 'main' into feat/sql-query-connector-on-wasm32-unknown-u…
jkomyno Nov 17, 2023
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
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ features = [
"pooled",
"postgresql",
"sqlite",
"native",
]

[profile.dev.package.backtrace]
Expand Down
2 changes: 1 addition & 1 deletion libs/user-facing-errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ backtrace = "0.3.40"
tracing = "0.1"
indoc.workspace = true
itertools = "0.10"
quaint = { workspace = true, optional = true }
quaint = { path = "../../quaint", optional = true }

[features]
default = []
Expand Down
43 changes: 34 additions & 9 deletions quaint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,28 @@ resolver = "2"
features = ["docs", "all"]

[features]
default = []
default = ["mysql", "postgresql", "mssql", "sqlite"]
docs = []
# Expose the underlying database drivers when a connector is enabled. This is a
# way to access database-specific methods when you need extra control.
expose-drivers = []

all = ["mssql", "mysql", "pooled", "postgresql", "sqlite"]
native = [
"postgresql-native",
"mysql-native",
"mssql-native",
"sqlite-native",
]

all = ["native", "pooled"]

vendored-openssl = [
"postgres-native-tls/vendored-openssl",
"mysql_async/vendored-openssl",
]

postgresql = [
postgresql-native = [
"postgresql",
"native-tls",
"tokio-postgres",
"postgres-types",
Expand All @@ -47,11 +55,24 @@ postgresql = [
"lru-cache",
"byteorder",
]
postgresql = []

mssql-native = [
"mssql",
"tiberius",
"tokio-util",
"tokio/time",
"tokio/net",
]
mssql = []

mysql-native = ["mysql", "mysql_async", "tokio/time", "lru-cache"]
mysql = ["chrono/std"]

mssql = ["tiberius", "tokio-util", "tokio/time", "tokio/net", "either"]
mysql = ["mysql_async", "tokio/time", "lru-cache"]
pooled = ["mobc"]
sqlite = ["rusqlite", "tokio/sync"]
sqlite-native = ["sqlite", "rusqlite/bundled", "tokio/sync"]
sqlite = []

fmt-sql = ["sqlformat"]

[dependencies]
Expand All @@ -67,7 +88,7 @@ futures = "0.3"
url = "2.1"
hex = "0.4"

either = { version = "1.6", optional = true }
either = { version = "1.6" }
base64 = { version = "0.12.3" }
chrono = { version = "0.4", default-features = false, features = ["serde"] }
lru-cache = { version = "0.1", optional = true }
Expand All @@ -88,7 +109,11 @@ paste = "1.0"
serde = { version = "1.0", features = ["derive"] }
quaint-test-macros = { path = "quaint-test-macros" }
quaint-test-setup = { path = "quaint-test-setup" }
tokio = { version = "1.0", features = ["rt-multi-thread", "macros", "time"] }
tokio = { version = "1.0", features = ["macros", "time"] }

[target.'cfg(target_arch = "wasm32")'.dependencies.getrandom]
version = "0.2"
features = ["js"]

[dependencies.byteorder]
default-features = false
Expand All @@ -102,7 +127,7 @@ branch = "vendored-openssl"

[dependencies.rusqlite]
version = "0.29"
features = ["chrono", "bundled", "column_decltype"]
features = ["chrono", "column_decltype"]
optional = true

[target.'cfg(not(any(target_os = "macos", target_os = "ios")))'.dependencies.tiberius]
Expand Down
4 changes: 4 additions & 0 deletions quaint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ Quaint is an abstraction over certain SQL databases. It provides:
### Feature flags

- `mysql`: Support for MySQL databases.
- On non-WebAssembly targets, choose `mysql-native` instead.
- `postgresql`: Support for PostgreSQL databases.
- On non-WebAssembly targets, choose `postgresql-native` instead.
- `sqlite`: Support for SQLite databases.
- On non-WebAssembly targets, choose `sqlite-native` instead.
- `mssql`: Support for Microsoft SQL Server databases.
- On non-WebAssembly targets, choose `mssql-native` instead.
- `pooled`: A connection pool in `pooled::Quaint`.
- `vendored-openssl`: Statically links against a vendored OpenSSL library on
non-Windows or non-Apple platforms.
Expand Down
50 changes: 31 additions & 19 deletions quaint/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,49 @@
//! querying interface.

mod connection_info;

pub mod metrics;
mod queryable;
mod result_set;
#[cfg(any(feature = "mssql", feature = "postgresql", feature = "mysql"))]
#[cfg(any(feature = "mssql-native", feature = "postgresql-native", feature = "mysql-native"))]
mod timeout;
mod transaction;
mod type_identifier;

#[cfg(feature = "mssql")]
pub(crate) mod mssql;
#[cfg(feature = "mysql")]
pub(crate) mod mysql;
#[cfg(feature = "postgresql")]
pub(crate) mod postgres;
#[cfg(feature = "sqlite")]
pub(crate) mod sqlite;

#[cfg(feature = "mysql")]
pub use self::mysql::*;
#[cfg(feature = "postgresql")]
pub use self::postgres::*;
pub use self::result_set::*;
pub use connection_info::*;
#[cfg(feature = "mssql")]
pub use mssql::*;
pub use queryable::*;
#[cfg(feature = "sqlite")]
pub use sqlite::*;
pub use transaction::*;
#[cfg(any(feature = "sqlite", feature = "mysql", feature = "postgresql"))]
#[cfg(any(feature = "mssql-native", feature = "postgresql-native", feature = "mysql-native"))]
#[allow(unused_imports)]
pub(crate) use type_identifier::*;

pub use self::metrics::query;

#[cfg(feature = "postgresql")]
pub(crate) mod postgres;
#[cfg(feature = "postgresql-native")]
pub use postgres::native::*;
#[cfg(feature = "postgresql")]
pub use postgres::wasm::common::*;

#[cfg(feature = "mysql")]
pub(crate) mod mysql;
#[cfg(feature = "mysql-native")]
pub use mysql::native::*;
#[cfg(feature = "mysql")]
pub use mysql::wasm::common::*;

#[cfg(feature = "sqlite")]
pub(crate) mod sqlite;
#[cfg(feature = "sqlite-native")]
pub use sqlite::native::*;
#[cfg(feature = "sqlite")]
pub use sqlite::wasm::common::*;

#[cfg(feature = "mssql")]
pub(crate) mod mssql;
#[cfg(feature = "mssql-native")]
pub use mssql::native::*;
#[cfg(feature = "mssql")]
pub use mssql::wasm::common::*;
Loading
Loading