CINXE.COM
sqlx - Rust
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The async SQL toolkit for Rust, built with 鉂わ笍 by the LaunchBadge team."><title>sqlx - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="/-/rustdoc.static/${f}">`).join(""))</script><link rel="stylesheet" href="/-/rustdoc.static/normalize-9960930a.css"><link rel="stylesheet" href="/-/static/vendored.css?0-6-0-ee9a3fe6-2025-03-28" media="all" /><link rel="stylesheet" href="/-/rustdoc.static/rustdoc-916cea96.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="/-/rustdoc.static/" data-current-crate="sqlx" data-themes="" data-resource-suffix="-20250224-1.87.0-nightly-617aad8c2" data-rustdoc-version="1.87.0-nightly (617aad8c2 2025-02-24)" data-channel="nightly" data-search-js="search-f7327375.js" data-settings-js="settings-d72f25bb.js" ><script src="/-/rustdoc.static/storage-d8ac8691.js"></script><script defer src="../crates-20250224-1.87.0-nightly-617aad8c2.js"></script><script defer src="/-/rustdoc.static/main-a7bf3405.js"></script><noscript><link rel="stylesheet" href="/-/rustdoc.static/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="/-/rustdoc.static/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="/-/rustdoc.static/favicon-044be391.svg"><link rel="stylesheet" href="/-/static/rustdoc-2021-12-05.css?0-6-0-ee9a3fe6-2025-03-28" media="all" /><link rel="stylesheet" href="/-/static/font-awesome.css?0-6-0-ee9a3fe6-2025-03-28" media="all" /> <link rel="search" href="/-/static/opensearch.xml" type="application/opensearchdescription+xml" title="Docs.rs" /> <script type="text/javascript">(function() { function applyTheme(theme) { if (theme) { document.documentElement.dataset.docsRsTheme = theme; } } window.addEventListener("storage", ev => { if (ev.key === "rustdoc-theme") { applyTheme(ev.newValue); } }); // see ./storage-change-detection.html for details window.addEventListener("message", ev => { if (ev.data && ev.data.storage && ev.data.storage.key === "rustdoc-theme") { applyTheme(ev.data.storage.value); } }); applyTheme(window.localStorage.getItem("rustdoc-theme")); })();</script></head><body class="rustdoc-page"> <div class="nav-container"> <div class="container"> <div class="pure-menu pure-menu-horizontal" role="navigation" aria-label="Main navigation"> <form action="/releases/search" method="GET" id="nav-search-form" class="landing-search-form-nav "> <a href="/" class="pure-menu-heading pure-menu-link docsrs-logo" aria-label="Docs.rs"> <span title="Docs.rs"><span class="fa fa-solid fa-cubes " aria-hidden="true"></span></span> <span class="title">Docs.rs</span> </a><ul class="pure-menu-list"> <script id="crate-metadata" type="application/json"> { "name": "sqlx", "version": "0.8.3" } </script><li class="pure-menu-item pure-menu-has-children"> <a href="#" class="pure-menu-link crate-name" title="馃О The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite."> <span class="fa fa-solid fa-cube " aria-hidden="true"></span> <span class="title">sqlx-0.8.3</span> </a><div class="pure-menu-children package-details-menu"> <ul class="pure-menu-list menu-item-divided"> <li class="pure-menu-heading" id="crate-title"> sqlx 0.8.3 <span id="clipboard" class="svg-clipboard" title="Copy crate name and version information"></span> </li><li class="pure-menu-item"> <a href="/sqlx/0.8.3/sqlx/index.html" class="pure-menu-link description" id="permalink" title="Get a link to this specific version"> <span class="fa fa-solid fa-link " aria-hidden="true"></span> Permalink </a> </li><li class="pure-menu-item"> <a href="/crate/sqlx/latest" class="pure-menu-link description" title="See sqlx in docs.rs"> <span class="fa fa-solid fa-cube " aria-hidden="true"></span> Docs.rs crate page </a> </li><li class="pure-menu-item"> <span class="pure-menu-link description"><span class="fa fa-solid fa-scale-unbalanced-flip " aria-hidden="true"></span> <a href="https://spdx.org/licenses/MIT" class="pure-menu-sublink">MIT</a> OR <a href="https://spdx.org/licenses/Apache-2.0" class="pure-menu-sublink">Apache-2.0</a></span> </li></ul> <div class="pure-g menu-item-divided"> <div class="pure-u-1-2 right-border"> <ul class="pure-menu-list"> <li class="pure-menu-heading">Links</li> <li class="pure-menu-item"> <a href="https://github.com/launchbadge/sqlx" class="pure-menu-link"> <span class="fa fa-solid fa-code-branch " aria-hidden="true"></span> Repository </a> </li><li class="pure-menu-item"> <a href="https://crates.io/crates/sqlx" class="pure-menu-link" title="See sqlx in crates.io"> <span class="fa fa-solid fa-cube " aria-hidden="true"></span> crates.io </a> </li> <li class="pure-menu-item"> <a href="/crate/sqlx/latest/source/" title="Browse source of sqlx-0.8.3" class="pure-menu-link"> <span class="fa fa-solid fa-folder-open " aria-hidden="true"></span> Source </a> </li> </ul> </div><div class="pure-u-1-2"> <ul class="pure-menu-list" id="topbar-owners"> <li class="pure-menu-heading">Owners</li><li class="pure-menu-item"> <a href="https://crates.io/users/mehcode" class="pure-menu-link"> <span class="fa fa-solid fa-user " aria-hidden="true"></span> mehcode </a> </li><li class="pure-menu-item"> <a href="https://crates.io/users/abonander" class="pure-menu-link"> <span class="fa fa-solid fa-user " aria-hidden="true"></span> abonander </a> </li></ul> </div> </div> <div class="pure-g menu-item-divided"> <div class="pure-u-1-2 right-border"> <ul class="pure-menu-list"> <li class="pure-menu-heading">Dependencies</li> <li class="pure-menu-item"> <div class="pure-menu pure-menu-scrollable sub-menu" tabindex="-1"> <ul class="pure-menu-list"> <li class="pure-menu-item"><a href="/sqlx-core/=0.8.3" class="pure-menu-link"> sqlx-core =0.8.3 <i class="dependencies normal">normal</i> </a> </li> <li class="pure-menu-item"><a href="/sqlx-macros/=0.8.3" class="pure-menu-link"> sqlx-macros =0.8.3 <i class="dependencies normal">normal</i> <i>optional</i> </a> </li> <li class="pure-menu-item"><a href="/sqlx-mysql/=0.8.3" class="pure-menu-link"> sqlx-mysql =0.8.3 <i class="dependencies normal">normal</i> <i>optional</i> </a> </li> <li class="pure-menu-item"><a href="/sqlx-postgres/=0.8.3" class="pure-menu-link"> sqlx-postgres =0.8.3 <i class="dependencies normal">normal</i> <i>optional</i> </a> </li> <li class="pure-menu-item"><a href="/sqlx-sqlite/=0.8.3" class="pure-menu-link"> sqlx-sqlite =0.8.3 <i class="dependencies normal">normal</i> <i>optional</i> </a> </li> <li class="pure-menu-item"><a href="/anyhow/^1.0.52" class="pure-menu-link"> anyhow ^1.0.52 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/async-std/^1.12" class="pure-menu-link"> async-std ^1.12 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/criterion/^0.5.1" class="pure-menu-link"> criterion ^0.5.1 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/dotenvy/^0.15.0" class="pure-menu-link"> dotenvy ^0.15.0 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/env_logger/^0.11" class="pure-menu-link"> env_logger ^0.11 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/futures/^0.3.19" class="pure-menu-link"> futures ^0.3.19 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/hex/^0.4.3" class="pure-menu-link"> hex ^0.4.3 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/paste/^1.0.6" class="pure-menu-link"> paste ^1.0.6 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/rand/^0.8.4" class="pure-menu-link"> rand ^0.8.4 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/rand_xoshiro/^0.6.0" class="pure-menu-link"> rand_xoshiro ^0.6.0 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/serde/^1.0.132" class="pure-menu-link"> serde ^1.0.132 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/serde_json/^1.0.73" class="pure-menu-link"> serde_json ^1.0.73 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/tempfile/^3.10.1" class="pure-menu-link"> tempfile ^3.10.1 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/time/^0.3.2" class="pure-menu-link"> time ^0.3.2 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/tokio/^1.15.0" class="pure-menu-link"> tokio ^1.15.0 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/trybuild/^1.0.53" class="pure-menu-link"> trybuild ^1.0.53 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/url/^2.2.2" class="pure-menu-link"> url ^2.2.2 <i class="dependencies dev">dev</i> </a> </li> <li class="pure-menu-item"><a href="/libsqlite3-sys/^0.30.1" class="pure-menu-link"> libsqlite3-sys ^0.30.1 <i class="dependencies dev">dev</i> </a> </li> </ul> </div> </li> </ul> </div> <div class="pure-u-1-2"> <ul class="pure-menu-list"> <li class="pure-menu-heading">Versions</li> <li class="pure-menu-item"> <div class="pure-menu pure-menu-scrollable sub-menu" id="releases-list" tabindex="-1" data-url="/crate/sqlx/latest/menus/releases/x86_64-unknown-linux-gnu/sqlx/index.html"> <span class="rotate"><span class="fa fa-solid fa-spinner " aria-hidden="true"></span></span> </div> </li> </ul> </div> </div> <div class="pure-g"> <div class="pure-u-1"> <ul class="pure-menu-list"> <li> <a href="/crate/sqlx/latest" class="pure-menu-link"> <b>100%</b> of the crate is documented </a> </li> </ul> </div> </div></div> </li><li class="pure-menu-item pure-menu-has-children"> <a href="#" class="pure-menu-link" aria-label="Platform"> <span class="fa fa-solid fa-gears " aria-hidden="true"></span> <span class="title">Platform</span> </a> <ul class="pure-menu-children" id="platforms" data-url="/crate/sqlx/latest/menus/platforms/x86_64-unknown-linux-gnu/sqlx/index.html"><li class="pure-menu-item"> <a href="/crate/sqlx/latest/target-redirect/i686-unknown-linux-gnu/sqlx/index.html" class="pure-menu-link" data-fragment="retain" rel="nofollow">i686-unknown-linux-gnu</a> </li><li class="pure-menu-item"> <a href="/crate/sqlx/latest/target-redirect/x86_64-unknown-linux-gnu/sqlx/index.html" class="pure-menu-link current" data-fragment="retain" rel="nofollow">x86_64-unknown-linux-gnu</a> </li></ul> </li><li class="pure-menu-item"> <a href="/crate/sqlx/latest/features" title="Browse available feature flags of sqlx-0.8.3" class="pure-menu-link"> <span class="fa fa-solid fa-flag " aria-hidden="true"></span> <span class="title">Feature flags</span> </a> </li> </ul><div class="spacer"></div> <ul class="pure-menu-list"> <li class="pure-menu-item pure-menu-has-children"> <a href="#" class="pure-menu-link" aria-label="Rust">Rust</a> <ul class="pure-menu-children"> <li class="pure-menu-item"> <a class="pure-menu-link" href="/about" > About docs.rs </a> </li> <li class="pure-menu-item"> <a class="pure-menu-link" href="https://foundation.rust-lang.org/policies/privacy-policy/#docs.rs" target="_blank"> Privacy policy </a> </li> <li class="pure-menu-item"> <a class="pure-menu-link" href="https://www.rust-lang.org/" target="_blank"> Rust website </a> </li> <li class="pure-menu-item"> <a class="pure-menu-link" href="https://doc.rust-lang.org/book/" target="_blank"> The Book </a> </li> <li class="pure-menu-item"> <a class="pure-menu-link" href="https://doc.rust-lang.org/std/" target="_blank"> Standard Library API Reference </a> </li> <li class="pure-menu-item"> <a class="pure-menu-link" href="https://doc.rust-lang.org/rust-by-example/" target="_blank"> Rust by Example </a> </li> <li class="pure-menu-item"> <a class="pure-menu-link" href="https://doc.rust-lang.org/cargo/guide/" target="_blank"> The Cargo Guide </a> </li> <li class="pure-menu-item"> <a class="pure-menu-link" href="https://doc.rust-lang.org/nightly/clippy" target="_blank"> Clippy Documentation </a> </li> </ul> </li> </ul> <div id="search-input-nav"> <label for="nav-search"> <span class="fa fa-solid fa-magnifying-glass " aria-hidden="true"></span> </label> <input id="nav-search" name="query" type="text" aria-label="Find crate by search query" tabindex="-1" placeholder="Find crate" > </div> </form> </div> </div> </div><div class="rustdoc mod crate container-rustdoc" id="rustdoc_body_wrapper" tabindex="-1"><script async src="/-/static/menu.js?0-6-0-ee9a3fe6-2025-03-28"></script> <script async src="/-/static/index.js?0-6-0-ee9a3fe6-2025-03-28"></script> <iframe src="/-/storage-change-detection.html" width="0" height="0" style="display: none"></iframe><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../sqlx/index.html">sqlx</a><span class="version">0.8.3</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#runtime-support" title="Runtime Support">Runtime Support</a></li><li><a href="#tls-support" title="TLS Support">TLS Support</a></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li><li><a href="#attributes" title="Attribute Macros">Attribute Macros</a></li><li><a href="#derives" title="Derive Macros">Derive Macros</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>sqlx</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/sqlx/lib.rs.html#1-166">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The async SQL toolkit for Rust, built with 鉂わ笍 by <a href="https://www.launchbadge.com">the LaunchBadge team</a>.</p> <p>See our <a href="https://www.github.com/launchbadge/sqlx/tree/main/README.md">README</a> to get started or <a href="https://www.github.com/launchbadge/sqlx/tree/main/examples">browse our example projects</a>. Have a question? <a href="https://www.github.com/launchbadge/sqlx/tree/main/FAQ.md">Check our FAQ</a> or <a href="https://github.com/launchbadge/sqlx/discussions/new?category=q-a">open a discussion</a>.</p> <h4 id="runtime-support"><a class="doc-anchor" href="#runtime-support">搂</a>Runtime Support</h4> <p>SQLx supports both the <a href="https://www.tokio.rs">Tokio</a> and <a href="https://www.async.rs">async-std</a> runtimes.</p> <p>You choose which runtime SQLx uses by default by enabling one of the following features:</p> <ul> <li><code>runtime-async-std</code></li> <li><code>runtime-tokio</code></li> </ul> <p>The <code>runtime-actix</code> feature also exists but is an alias of <code>runtime-tokio</code>.</p> <p>If more than one runtime feature is enabled, the Tokio runtime is used if a Tokio context exists on the current thread, i.e. <a href="https://docs.rs/tokio/latest/tokio/runtime/struct.Handle.html#method.try_current"><code>tokio::runtime::Handle::try_current()</code></a> returns <code>Ok</code>; <code>async-std</code> is used otherwise.</p> <p>Note that while SQLx no longer produces a compile error if zero or multiple runtime features are enabled, which is useful for libraries building on top of it, <strong>the use of nearly any async function in the API will panic without at least one runtime feature enabled</strong>.</p> <p>The chief exception is the SQLite driver, which is runtime-agnostic, including its integration with the query macros. However, <a href="type.SqlitePool.html" title="type sqlx::SqlitePool"><code>SqlitePool</code></a> <em>does</em> require runtime support for timeouts and spawning internal management tasks.</p> <h4 id="tls-support"><a class="doc-anchor" href="#tls-support">搂</a>TLS Support</h4> <p>For securely communicating with SQL servers over an untrusted network connection such as the internet, you can enable Transport Layer Security (TLS) by enabling one of the following features:</p> <ul> <li><code>tls-native-tls</code>: Enables the <a href="https://docs.rs/native-tls/latest/native_tls/"><code>native-tls</code></a> backend which uses the OS-native TLS capabilities: <ul> <li>SecureTransport on macOS.</li> <li>SChannel on Windows.</li> <li>OpenSSL on all other platforms.</li> </ul> </li> <li><code>tls-rustls</code>: Enables the <a href="https://docs.rs/rustls/latest/rustls/">rustls</a> backend, a cross-platform TLS library. <ul> <li>Only supports TLS revisions 1.2 and 1.3.</li> <li>If you get <code>HandshakeFailure</code> errors when using this feature, it likely means your database server does not support these newer revisions. This might be resolved by enabling or switching to the <code>tls-native-tls</code> feature.</li> <li>rustls supports several providers of cryptographic primitives. The default (enabled when you use the <code>tls-rustls</code> feature or <code>tls-rustls-ring</code>) is the <code>ring</code> provider, which has fewer build-time dependencies but also has fewer features. Alternatively, you can use <code>tls-rustls-aws-lc-rs</code> to use the <code>aws-lc-rs</code> provider, which enables additional cipher suite support at the cost of more onerous build requirements (depending on platform support).</li> </ul> </li> </ul> <p>If more than one TLS feature is enabled, the <code>tls-native-tls</code> feature takes precedent so that it is only necessary to enable it to see if it resolves the <code>HandshakeFailure</code> error without disabling <code>tls-rustls</code>.</p> <p>Consult the user manual for your database to find the TLS versions it supports.</p> <p>If your connection configuration requires a TLS upgrade but TLS support was not enabled, the connection attempt will return an error.</p> <p>The legacy runtime+TLS combination feature flags are still supported, but for forward-compatibility, use of the separate runtime and TLS feature flags is recommended.</p> </div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">搂</a></h2><dl class="item-table"><dt><a class="mod" href="any/index.html" title="mod sqlx::any">any</a></dt><dd><strong>SEE DOCUMENTATION BEFORE USE</strong>. Runtime-generic database driver.</dd><dt><a class="mod" href="database/index.html" title="mod sqlx::database">database</a></dt><dd>Traits to represent a database driver.</dd><dt><a class="mod" href="decode/index.html" title="mod sqlx::decode">decode</a></dt><dd>Provides <a href="trait.Decode.html" title="trait sqlx::Decode"><code>Decode</code></a> for decoding values from the database.</dd><dt><a class="mod" href="encode/index.html" title="mod sqlx::encode">encode</a></dt><dd>Provides <a href="trait.Encode.html" title="trait sqlx::Encode"><code>Encode</code></a> for encoding values for the database.</dd><dt><a class="mod" href="error/index.html" title="mod sqlx::error">error</a></dt><dd>Types for working with errors produced by SQLx.</dd><dt><a class="mod" href="migrate/index.html" title="mod sqlx::migrate">migrate</a></dt><dt><a class="mod" href="mysql/index.html" title="mod sqlx::mysql">mysql</a><wbr><span class="stab portability" title="Available on crate feature `mysql` only"><code>mysql</code></span></dt><dd><strong>MySQL</strong> database driver.</dd><dt><a class="mod" href="pool/index.html" title="mod sqlx::pool">pool</a></dt><dd>Provides the connection pool for asynchronous SQLx connections.</dd><dt><a class="mod" href="postgres/index.html" title="mod sqlx::postgres">postgres</a><wbr><span class="stab portability" title="Available on crate feature `postgres` only"><code>postgres</code></span></dt><dd><strong>PostgreSQL</strong> database driver.</dd><dt><a class="mod" href="prelude/index.html" title="mod sqlx::prelude">prelude</a></dt><dd>Convenience re-export of common traits.</dd><dt><a class="mod" href="query/index.html" title="mod sqlx::query">query</a></dt><dd>Types and traits for the <code>query</code> family of functions and macros.</dd><dt><a class="mod" href="query_builder/index.html" title="mod sqlx::query_builder">query_<wbr>builder</a></dt><dd>Runtime query-builder API.</dd><dt><a class="mod" href="sqlite/index.html" title="mod sqlx::sqlite">sqlite</a><wbr><span class="stab portability" title="Available on crate feature `_sqlite` only"><code>_sqlite</code></span></dt><dd><strong>SQLite</strong> database driver.</dd><dt><a class="mod" href="types/index.html" title="mod sqlx::types">types</a></dt><dd>Conversions between Rust and SQL types.</dd></dl><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">搂</a></h2><dl class="item-table"><dt><a class="macro" href="macro.migrate.html" title="macro sqlx::migrate">migrate</a></dt><dd>Embeds migrations into the binary by expanding to a static instance of <a href="migrate/struct.Migrator.html" title="struct sqlx::migrate::Migrator">Migrator</a>.</dd><dt><a class="macro" href="macro.query.html" title="macro sqlx::query">query</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>Statically checked SQL query with <code>println!()</code> style syntax.</dd><dt><a class="macro" href="macro.query_as.html" title="macro sqlx::query_as">query_<wbr>as</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query.html" title="macro sqlx::query"><code>query!</code></a> which takes a path to an explicitly defined struct as the output type.</dd><dt><a class="macro" href="macro.query_as_unchecked.html" title="macro sqlx::query_as_unchecked">query_<wbr>as_<wbr>unchecked</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query_as.html" title="macro sqlx::query_as"><code>query_as!</code></a> which does not check the input or output types. This still does parse the query to ensure it鈥檚 syntactically and semantically valid for the current database.</dd><dt><a class="macro" href="macro.query_file.html" title="macro sqlx::query_file">query_<wbr>file</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query.html" title="macro sqlx::query"><code>query!</code></a> where the SQL query is stored in a separate file.</dd><dt><a class="macro" href="macro.query_file_as.html" title="macro sqlx::query_file_as">query_<wbr>file_<wbr>as</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>Combines the syntaxes of <a href="macro.query_as.html" title="macro sqlx::query_as"><code>query_as!</code></a> and <a href="macro.query_file.html" title="macro sqlx::query_file"><code>query_file!</code></a>.</dd><dt><a class="macro" href="macro.query_file_as_unchecked.html" title="macro sqlx::query_file_as_unchecked">query_<wbr>file_<wbr>as_<wbr>unchecked</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query_file_as.html" title="macro sqlx::query_file_as"><code>query_file_as!</code></a> which does not check the input or output types. This still does parse the query to ensure it鈥檚 syntactically and semantically valid for the current database.</dd><dt><a class="macro" href="macro.query_file_scalar.html" title="macro sqlx::query_file_scalar">query_<wbr>file_<wbr>scalar</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query_scalar.html" title="macro sqlx::query_scalar"><code>query_scalar!</code></a> which takes a file path like <a href="macro.query_file.html" title="macro sqlx::query_file"><code>query_file!</code></a>.</dd><dt><a class="macro" href="macro.query_file_scalar_unchecked.html" title="macro sqlx::query_file_scalar_unchecked">query_<wbr>file_<wbr>scalar_<wbr>unchecked</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query_file_scalar.html" title="macro sqlx::query_file_scalar"><code>query_file_scalar!</code></a> which does not typecheck bind parameters and leaves the output type to inference. The query itself is still checked that it is syntactically and semantically valid for the database, that it only produces one column and that the number of bind parameters is correct.</dd><dt><a class="macro" href="macro.query_file_unchecked.html" title="macro sqlx::query_file_unchecked">query_<wbr>file_<wbr>unchecked</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query_file.html" title="macro sqlx::query_file"><code>query_file!</code></a> which does not check the input or output types. This still does parse the query to ensure it鈥檚 syntactically and semantically valid for the current database.</dd><dt><a class="macro" href="macro.query_scalar.html" title="macro sqlx::query_scalar">query_<wbr>scalar</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query.html" title="macro sqlx::query"><code>query!</code></a> which expects a single column from the query and evaluates to an instance of <a href="query/struct.QueryScalar.html" title="struct sqlx::query::QueryScalar">QueryScalar</a>.</dd><dt><a class="macro" href="macro.query_scalar_unchecked.html" title="macro sqlx::query_scalar_unchecked">query_<wbr>scalar_<wbr>unchecked</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query_scalar.html" title="macro sqlx::query_scalar"><code>query_scalar!</code></a> which does not typecheck bind parameters and leaves the output type to inference. The query itself is still checked that it is syntactically and semantically valid for the database, that it only produces one column and that the number of bind parameters is correct.</dd><dt><a class="macro" href="macro.query_unchecked.html" title="macro sqlx::query_unchecked">query_<wbr>unchecked</a><wbr><span class="stab portability" title="Available on crate feature `macros` only"><code>macros</code></span></dt><dd>A variant of <a href="macro.query.html" title="macro sqlx::query"><code>query!</code></a> which does not check the input or output types. This still does parse the query to ensure it鈥檚 syntactically and semantically valid for the current database.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">搂</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Any.html" title="struct sqlx::Any">Any</a><wbr><span class="stab portability" title="Available on crate feature `any` only"><code>any</code></span></dt><dd>Opaque database driver. Capable of being used in place of any SQLx database driver. The actual driver used will be selected at runtime, from the connection url.</dd><dt><a class="struct" href="struct.AnyConnection.html" title="struct sqlx::AnyConnection">AnyConnection</a></dt><dd><strong>SEE DOCUMENTATION BEFORE USE</strong>. Runtime-generic database connection.</dd><dt><a class="struct" href="struct.MySql.html" title="struct sqlx::MySql">MySql</a><wbr><span class="stab portability" title="Available on crate feature `mysql` only"><code>mysql</code></span></dt><dd>MySQL database driver.</dd><dt><a class="struct" href="struct.MySqlConnection.html" title="struct sqlx::MySqlConnection">MySql<wbr>Connection</a><wbr><span class="stab portability" title="Available on crate feature `mysql` only"><code>mysql</code></span></dt><dd>A connection to a MySQL database.</dd><dt><a class="struct" href="struct.PgConnection.html" title="struct sqlx::PgConnection">PgConnection</a><wbr><span class="stab portability" title="Available on crate feature `postgres` only"><code>postgres</code></span></dt><dd>A connection to a PostgreSQL database.</dd><dt><a class="struct" href="struct.Pool.html" title="struct sqlx::Pool">Pool</a></dt><dd>An asynchronous pool of SQLx database connections.</dd><dt><a class="struct" href="struct.Postgres.html" title="struct sqlx::Postgres">Postgres</a><wbr><span class="stab portability" title="Available on crate feature `postgres` only"><code>postgres</code></span></dt><dd>PostgreSQL database driver.</dd><dt><a class="struct" href="struct.QueryBuilder.html" title="struct sqlx::QueryBuilder">Query<wbr>Builder</a></dt><dd>A builder type for constructing queries at runtime.</dd><dt><a class="struct" href="struct.RawSql.html" title="struct sqlx::RawSql">RawSql</a></dt><dd>One or more raw SQL statements, separated by semicolons (<code>;</code>).</dd><dt><a class="struct" href="struct.Sqlite.html" title="struct sqlx::Sqlite">Sqlite</a><wbr><span class="stab portability" title="Available on crate feature `_sqlite` only"><code>_sqlite</code></span></dt><dd>Sqlite database driver.</dd><dt><a class="struct" href="struct.SqliteConnection.html" title="struct sqlx::SqliteConnection">Sqlite<wbr>Connection</a><wbr><span class="stab portability" title="Available on crate feature `_sqlite` only"><code>_sqlite</code></span></dt><dd>A connection to an open <a href="struct.Sqlite.html" title="struct sqlx::Sqlite">Sqlite</a> database.</dd><dt><a class="struct" href="struct.Transaction.html" title="struct sqlx::Transaction">Transaction</a></dt><dd>An in-progress database transaction or savepoint.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">搂</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Either.html" title="enum sqlx::Either">Either</a></dt><dd>The enum <code>Either</code> with variants <code>Left</code> and <code>Right</code> is a general purpose sum type with two cases.</dd><dt><a class="enum" href="enum.Error.html" title="enum sqlx::Error">Error</a></dt><dd>Represents all the ways a method can fail within SQLx.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">搂</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Acquire.html" title="trait sqlx::Acquire">Acquire</a></dt><dd>Acquire connections or transactions from a database in a generic way.</dd><dt><a class="trait" href="trait.AnyExecutor.html" title="trait sqlx::AnyExecutor">AnyExecutor</a><wbr><span class="stab portability" title="Available on crate feature `any` only"><code>any</code></span></dt><dd>An alias for <a href="trait.Executor.html" title="trait sqlx::Executor"><code>Executor<'_, Database = Any></code></a>.</dd><dt><a class="trait" href="trait.Arguments.html" title="trait sqlx::Arguments">Arguments</a></dt><dd>A tuple of arguments to be sent to the database.</dd><dt><a class="trait" href="trait.Column.html" title="trait sqlx::Column">Column</a></dt><dt><a class="trait" href="trait.ColumnIndex.html" title="trait sqlx::ColumnIndex">Column<wbr>Index</a></dt><dd>A type that can be used to index into a <a href="trait.Row.html" title="trait sqlx::Row"><code>Row</code></a> or <a href="trait.Statement.html" title="trait sqlx::Statement"><code>Statement</code></a>.</dd><dt><a class="trait" href="trait.ConnectOptions.html" title="trait sqlx::ConnectOptions">Connect<wbr>Options</a></dt><dt><a class="trait" href="trait.Connection.html" title="trait sqlx::Connection">Connection</a></dt><dd>Represents a single database connection.</dd><dt><a class="trait" href="trait.Database.html" title="trait sqlx::Database">Database</a></dt><dd>A database driver.</dd><dt><a class="trait" href="trait.Decode.html" title="trait sqlx::Decode">Decode</a></dt><dd>A type that can be decoded from the database.</dd><dt><a class="trait" href="trait.Encode.html" title="trait sqlx::Encode">Encode</a></dt><dd>Encode a single value to be sent to the database.</dd><dt><a class="trait" href="trait.Execute.html" title="trait sqlx::Execute">Execute</a></dt><dd>A type that may be executed against a database connection.</dd><dt><a class="trait" href="trait.Executor.html" title="trait sqlx::Executor">Executor</a></dt><dd>A type that contains or can provide a database connection to use for executing queries against the database.</dd><dt><a class="trait" href="trait.FromRow.html" title="trait sqlx::FromRow">FromRow</a></dt><dd>A record that can be built from a row returned by the database.</dd><dt><a class="trait" href="trait.IntoArguments.html" title="trait sqlx::IntoArguments">Into<wbr>Arguments</a></dt><dt><a class="trait" href="trait.MySqlExecutor.html" title="trait sqlx::MySqlExecutor">MySql<wbr>Executor</a><wbr><span class="stab portability" title="Available on crate feature `mysql` only"><code>mysql</code></span></dt><dd>An alias for <a href="trait.Executor.html" title="trait sqlx::Executor"><code>Executor<'_, Database = MySql></code></a>.</dd><dt><a class="trait" href="trait.PgExecutor.html" title="trait sqlx::PgExecutor">PgExecutor</a><wbr><span class="stab portability" title="Available on crate feature `postgres` only"><code>postgres</code></span></dt><dd>An alias for <a href="trait.Executor.html" title="trait sqlx::Executor"><code>Executor<'_, Database = Postgres></code></a>.</dd><dt><a class="trait" href="trait.Row.html" title="trait sqlx::Row">Row</a></dt><dd>Represents a single row from the database.</dd><dt><a class="trait" href="trait.SqliteExecutor.html" title="trait sqlx::SqliteExecutor">Sqlite<wbr>Executor</a><wbr><span class="stab portability" title="Available on crate feature `_sqlite` only"><code>_sqlite</code></span></dt><dd>An alias for <a href="trait.Executor.html" title="trait sqlx::Executor"><code>Executor<'_, Database = Sqlite></code></a>.</dd><dt><a class="trait" href="trait.Statement.html" title="trait sqlx::Statement">Statement</a></dt><dd>An explicitly prepared statement.</dd><dt><a class="trait" href="trait.Type.html" title="trait sqlx::Type">Type</a></dt><dd>Indicates that a SQL type is supported for a database.</dd><dt><a class="trait" href="trait.TypeInfo.html" title="trait sqlx::TypeInfo">Type<wbr>Info</a></dt><dd>Provides information about a SQL type for the database driver.</dd><dt><a class="trait" href="trait.Value.html" title="trait sqlx::Value">Value</a></dt><dd>An owned value from the database.</dd><dt><a class="trait" href="trait.ValueRef.html" title="trait sqlx::ValueRef">Value<wbr>Ref</a></dt><dd>A reference to a single value from the database.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">搂</a></h2><dl class="item-table"><dt><a class="fn" href="fn.query.html" title="fn sqlx::query">query</a></dt><dd>Execute a single SQL query as a prepared statement (transparently cached).</dd><dt><a class="fn" href="fn.query_as.html" title="fn sqlx::query_as">query_<wbr>as</a></dt><dd>Execute a single SQL query as a prepared statement (transparently cached). Maps rows to Rust types using <a href="trait.FromRow.html" title="trait sqlx::FromRow"><code>FromRow</code></a>.</dd><dt><a class="fn" href="fn.query_as_with.html" title="fn sqlx::query_as_with">query_<wbr>as_<wbr>with</a></dt><dd>Execute a single SQL query, with the given arguments as a prepared statement (transparently cached). Maps rows to Rust types using <a href="trait.FromRow.html" title="trait sqlx::FromRow"><code>FromRow</code></a>.</dd><dt><a class="fn" href="fn.query_scalar.html" title="fn sqlx::query_scalar">query_<wbr>scalar</a></dt><dd>Execute a single SQL query as a prepared statement (transparently cached) and extract the first column of each row.</dd><dt><a class="fn" href="fn.query_scalar_with.html" title="fn sqlx::query_scalar_with">query_<wbr>scalar_<wbr>with</a></dt><dd>Execute a SQL query as a prepared statement (transparently cached), with the given arguments, and extract the first column of each row.</dd><dt><a class="fn" href="fn.query_with.html" title="fn sqlx::query_with">query_<wbr>with</a></dt><dd>Execute a SQL query as a prepared statement (transparently cached), with the given arguments.</dd><dt><a class="fn" href="fn.raw_sql.html" title="fn sqlx::raw_sql">raw_sql</a></dt><dd>Execute one or more statements as raw SQL, separated by semicolons (<code>;</code>).</dd></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">搂</a></h2><dl class="item-table"><dt><a class="type" href="type.AnyPool.html" title="type sqlx::AnyPool">AnyPool</a></dt><dd><strong>SEE DOCUMENTATION BEFORE USE</strong>. Type alias for <code>Pool<Any></code>.</dd><dt><a class="type" href="type.MySqlPool.html" title="type sqlx::MySqlPool">MySql<wbr>Pool</a><wbr><span class="stab portability" title="Available on crate feature `mysql` only"><code>mysql</code></span></dt><dd>An alias for <a href="struct.Pool.html" title="struct sqlx::Pool"><code>Pool</code></a>, specialized for MySQL.</dd><dt><a class="type" href="type.MySqlTransaction.html" title="type sqlx::MySqlTransaction">MySql<wbr>Transaction</a><wbr><span class="stab portability" title="Available on crate feature `mysql` only"><code>mysql</code></span></dt><dd>An alias for <a href="struct.Transaction.html" title="struct sqlx::Transaction"><code>Transaction</code></a>, specialized for MySQL.</dd><dt><a class="type" href="type.PgPool.html" title="type sqlx::PgPool">PgPool</a><wbr><span class="stab portability" title="Available on crate feature `postgres` only"><code>postgres</code></span></dt><dd>An alias for <a href="struct.Pool.html" title="struct sqlx::Pool"><code>Pool</code></a>, specialized for Postgres.</dd><dt><a class="type" href="type.PgTransaction.html" title="type sqlx::PgTransaction">PgTransaction</a><wbr><span class="stab portability" title="Available on crate feature `postgres` only"><code>postgres</code></span></dt><dd>An alias for <a href="struct.Transaction.html" title="struct sqlx::Transaction"><code>Transaction</code></a>, specialized for Postgres.</dd><dt><a class="type" href="type.Result.html" title="type sqlx::Result">Result</a></dt><dd>A specialized <code>Result</code> type for SQLx.</dd><dt><a class="type" href="type.SqlitePool.html" title="type sqlx::SqlitePool">Sqlite<wbr>Pool</a><wbr><span class="stab portability" title="Available on crate feature `_sqlite` only"><code>_sqlite</code></span></dt><dd>An alias for <a href="struct.Pool.html" title="struct sqlx::Pool"><code>Pool</code></a>, specialized for SQLite.</dd><dt><a class="type" href="type.SqliteTransaction.html" title="type sqlx::SqliteTransaction">Sqlite<wbr>Transaction</a><wbr><span class="stab portability" title="Available on crate feature `_sqlite` only"><code>_sqlite</code></span></dt><dd>An alias for <a href="struct.Transaction.html" title="struct sqlx::Transaction"><code>Transaction</code></a>, specialized for SQLite.</dd></dl><h2 id="attributes" class="section-header">Attribute Macros<a href="#attributes" class="anchor">搂</a></h2><dl class="item-table"><dt><a class="attr" href="attr.test.html" title="attr sqlx::test">test</a></dt><dd>Mark an <code>async fn</code> as a test with SQLx support.</dd></dl><h2 id="derives" class="section-header">Derive Macros<a href="#derives" class="anchor">搂</a></h2><dl class="item-table"><dt><a class="derive" href="derive.Decode.html" title="derive sqlx::Decode">Decode</a></dt><dt><a class="derive" href="derive.Encode.html" title="derive sqlx::Encode">Encode</a></dt></dl><script type="text/json" id="notable-traits-data">{"&[u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</div>","CloseEvent":"<h3>Notable traits for <code><a class=\"struct\" href=\"pool/struct.CloseEvent.html\" title=\"struct sqlx::pool::CloseEvent\">CloseEvent</a></code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"pool/struct.CloseEvent.html\" title=\"struct sqlx::pool::CloseEvent\">CloseEvent</a></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.unit.html\">()</a>;</div>"}</script></section></div></main></div></body></html>