sqlx_core/
lib.rs

1//! Core of SQLx, the rust SQL toolkit.
2//!
3//! ### Note: Semver Exempt API
4//! The API of this crate is not meant for general use and does *not* follow Semantic Versioning.
5//! The only crate that follows Semantic Versioning in the project is the `sqlx` crate itself.
6//! If you are building a custom SQLx driver, you should pin an exact version for `sqlx-core` to
7//! avoid breakages:
8//!
9//! ```toml
10//! sqlx-core = { version = "=0.6.2" }
11//! ```
12//!
13//! And then make releases in lockstep with `sqlx-core`. We recommend all driver crates, in-tree
14//! or otherwise, use the same version numbers as `sqlx-core` to avoid confusion.
15#![recursion_limit = "512"]
16#![warn(future_incompatible, rust_2018_idioms)]
17#![allow(clippy::needless_doctest_main, clippy::type_complexity)]
18// The only unsafe code in SQLx is that necessary to interact with native APIs like with SQLite,
19// and that can live in its own separate driver crate.
20#![forbid(unsafe_code)]
21// Allows an API be documented as only available in some specific platforms.
22// <https://doc.rust-lang.org/unstable-book/language-features/doc-cfg.html>
23#![cfg_attr(docsrs, feature(doc_cfg))]
24
25#[macro_use]
26pub mod ext;
27
28#[macro_use]
29pub mod error;
30
31#[macro_use]
32pub mod arguments;
33
34#[macro_use]
35pub mod pool;
36
37pub mod connection;
38
39#[macro_use]
40pub mod transaction;
41
42#[macro_use]
43pub mod encode;
44
45#[macro_use]
46pub mod decode;
47
48#[macro_use]
49pub mod types;
50
51#[macro_use]
52pub mod query;
53
54#[macro_use]
55pub mod acquire;
56
57#[macro_use]
58pub mod column;
59
60#[macro_use]
61pub mod statement;
62
63pub mod common;
64pub mod database;
65pub mod describe;
66pub mod executor;
67pub mod from_row;
68pub mod fs;
69pub mod io;
70pub mod logger;
71pub mod net;
72pub mod query_as;
73pub mod query_builder;
74pub mod query_scalar;
75pub mod sql_str;
76
77pub mod raw_sql;
78pub mod row;
79pub mod rt;
80pub mod sync;
81pub mod type_checking;
82pub mod type_info;
83pub mod value;
84
85#[cfg(feature = "migrate")]
86pub mod migrate;
87
88#[cfg(feature = "any")]
89pub mod any;
90
91// Implements test support with automatic DB management.
92#[cfg(feature = "migrate")]
93pub mod testing;
94
95pub mod config;
96
97pub use error::{Error, Result};
98
99pub use either::Either;
100pub use hashbrown::{hash_map, HashMap};
101pub use indexmap::IndexMap;
102pub use percent_encoding;
103pub use smallvec::SmallVec;
104pub use url::{self, Url};
105
106pub use bytes;
107
108/// Helper module to get drivers compiling again that used to be in this crate,
109/// to avoid having to replace tons of `use crate::<...>` imports.
110///
111/// This module can be glob-imported and should not clash with any modules a driver
112/// would want to implement itself.
113pub mod driver_prelude {
114    pub use crate::{
115        acquire, common, decode, describe, encode, executor, ext, from_row, fs, io, logger, net,
116        pool, query, query_as, query_builder, query_scalar, rt, sync,
117    };
118
119    pub use crate::error::{Error, Result};
120    pub use crate::{hash_map, HashMap};
121    pub use either::Either;
122}