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;
75
76pub mod raw_sql;
77pub mod row;
78pub mod rt;
79pub mod sync;
80pub mod type_checking;
81pub mod type_info;
82pub mod value;
83
84#[cfg(feature = "migrate")]
85pub mod migrate;
86
87#[cfg(feature = "any")]
88pub mod any;
89
90// Implements test support with automatic DB management.
91#[cfg(feature = "migrate")]
92pub mod testing;
93
94pub use error::{Error, Result};
95
96pub use either::Either;
97pub use hashbrown::{hash_map, HashMap};
98pub use indexmap::IndexMap;
99pub use percent_encoding;
100pub use smallvec::SmallVec;
101pub use url::{self, Url};
102
103pub use bytes;
104
105/// Helper module to get drivers compiling again that used to be in this crate,
106/// to avoid having to replace tons of `use crate::<...>` imports.
107///
108/// This module can be glob-imported and should not clash with any modules a driver
109/// would want to implement itself.
110pub mod driver_prelude {
111    pub use crate::{
112        acquire, common, decode, describe, encode, executor, ext, from_row, fs, io, logger, net,
113        pool, query, query_as, query_builder, query_scalar, rt, sync,
114    };
115
116    pub use crate::error::{Error, Result};
117    pub use crate::{hash_map, HashMap};
118    pub use either::Either;
119}