Skip to main content

sea_query_sqlx/
lib.rs

1#![forbid(unsafe_code)]
2
3//! Driver library for using SeaQuery with SQLx
4//!
5//! This library introduces various traits that add methods to the query types from `sea-query`.
6//! For instance, using the [`SqlxBinder`] trait adds a [`SqlxBinder::build_sqlx`] method that
7//! returns the query and a [`SqlxValues`] object, which can be directly passed to `sqlx`'s
8//! [`sqlx::query_with`][1] method.
9//!
10//! [1]: ../sqlx/fn.query_with.html
11
12#[cfg(all(
13    any(
14        feature = "sqlx-mysql",
15        feature = "sqlx-postgres",
16        feature = "sqlx-any"
17    ),
18    feature = "with-jiff",
19    not(feature = "unimplemented-jiff-sqlx")
20))]
21const _: () = panic!(
22    "sea-query-sqlx does not support with-jiff together with sqlx-mysql/sqlx-postgres/sqlx-any yet; \
23enable the `unimplemented-jiff-sqlx` feature to acknowledge the limitation and keep the \
24current runtime panic behavior"
25);
26
27#[cfg(feature = "sqlx-any")]
28mod sqlx_any;
29#[cfg(feature = "sqlx-mysql")]
30mod sqlx_mysql;
31#[cfg(feature = "sqlx-postgres")]
32mod sqlx_postgres;
33#[cfg(feature = "sqlx-sqlite")]
34mod sqlx_sqlite;
35
36mod values;
37pub use crate::values::SqlxValues;
38
39#[cfg(any(
40    feature = "sqlx-mysql",
41    feature = "sqlx-postgres",
42    feature = "sqlx-sqlite",
43    feature = "sqlx-any"
44))]
45mod sqlx;
46#[cfg(any(
47    feature = "sqlx-mysql",
48    feature = "sqlx-postgres",
49    feature = "sqlx-sqlite",
50    feature = "sqlx-any"
51))]
52pub use crate::sqlx::SqlxBinder;