Fix several inter doc links (#2954)

This commit is contained in:
Ralph Bisschops 2024-05-31 21:59:08 +02:00 committed by GitHub
parent f960d5bc3b
commit 240b4fffd3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 27 deletions

View file

@ -4,4 +4,6 @@ The underlying database drivers are chosen at runtime from the list set via
without this will panic. without this will panic.
It is recommended to use [`install_default_drivers`][crate::any::install_default_drivers] to activate all currently compiled-in drivers. It is recommended to use [`install_default_drivers`][crate::any::install_default_drivers] to activate all currently compiled-in drivers.
[`AnyConnection`]: sqlx_core::any::AnyConnection
[`AnyPool`]: sqlx_core::any::AnyPool

View file

@ -27,6 +27,8 @@ pub(crate) mod reexports {
/// ///
/// ### Panics /// ### Panics
/// If [`install_drivers`] has already been called *not* through this function. /// If [`install_drivers`] has already been called *not* through this function.
///
/// [`AnyConnection`]: sqlx_core::any::AnyConnection
pub fn install_default_drivers() { pub fn install_default_drivers() {
static ONCE: Once = Once::new(); static ONCE: Once = Once::new();

View file

@ -97,7 +97,6 @@ pub use sqlx_core::rt as __rt;
/// * Postgres: [postgres::types] /// * Postgres: [postgres::types]
/// * MySQL: [mysql::types] /// * MySQL: [mysql::types]
/// * SQLite: [sqlite::types] /// * SQLite: [sqlite::types]
/// * MSSQL: [mssql::types]
/// ///
/// Any external types that have had [`Type`] implemented for, are re-exported in this module /// Any external types that have had [`Type`] implemented for, are re-exported in this module
/// for convenience as downstream users need to use a compatible version of the external crate /// for convenience as downstream users need to use a compatible version of the external crate
@ -112,7 +111,7 @@ pub mod types {
pub use sqlx_macros::Type; pub use sqlx_macros::Type;
} }
/// Provides [`Encode`](encode::Encode) for encoding values for the database. /// Provides [`Encode`] for encoding values for the database.
pub mod encode { pub mod encode {
pub use sqlx_core::encode::{Encode, IsNull}; pub use sqlx_core::encode::{Encode, IsNull};
@ -123,7 +122,7 @@ pub mod encode {
pub use self::encode::Encode; pub use self::encode::Encode;
/// Provides [`Decode`](decode::Decode) for decoding values from the database. /// Provides [`Decode`] for decoding values from the database.
pub mod decode { pub mod decode {
pub use sqlx_core::decode::Decode; pub use sqlx_core::decode::Decode;

View file

@ -306,9 +306,9 @@
/// See [the README for `sqlx-cli`](https://crates.io/crates/sqlx-cli) for more information. /// See [the README for `sqlx-cli`](https://crates.io/crates/sqlx-cli) for more information.
/// ///
/// ## See Also /// ## See Also
/// * [query_as!] if you want to use a struct you can name, /// * [`query_as!`][`crate::query_as!`] if you want to use a struct you can name,
/// * [query_file!] if you want to define the SQL query out-of-line, /// * [`query_file!`][`crate::query_file!`] if you want to define the SQL query out-of-line,
/// * [query_file_as!] if you want both of the above. /// * [`query_file_as!`][`crate::query_file_as!`] if you want both of the above.
#[macro_export] #[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
macro_rules! query ( macro_rules! query (
@ -329,7 +329,7 @@ macro_rules! query (
}) })
); );
/// A variant of [query!] which does not check the input or output types. This still does parse /// A variant of [`query!`][`crate::query!`] which does not check the input or output types. This still does parse
/// the query to ensure it's syntactically and semantically valid for the current database. /// the query to ensure it's syntactically and semantically valid for the current database.
#[macro_export] #[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
@ -342,12 +342,12 @@ macro_rules! query_unchecked (
}) })
); );
/// A variant of [query!] where the SQL query is stored in a separate file. /// A variant of [`query!`][`crate::query!`] where the SQL query is stored in a separate file.
/// ///
/// Useful for large queries and potentially cleaner than multiline strings. /// Useful for large queries and potentially cleaner than multiline strings.
/// ///
/// The syntax and requirements (see [query!]) are the same except the SQL string is replaced by a /// The syntax and requirements (see [`query!`][`crate::query!`]) are the same except the SQL
/// file path. /// string is replaced by a file path.
/// ///
/// The file must be relative to the project root (the directory containing `Cargo.toml`), /// The file must be relative to the project root (the directory containing `Cargo.toml`),
/// unlike `include_str!()` which uses compiler internals to get the path of the file where it /// unlike `include_str!()` which uses compiler internals to get the path of the file where it
@ -395,8 +395,9 @@ macro_rules! query_file (
}) })
); );
/// A variant of [query_file!] which does not check the input or output types. This still does parse /// A variant of [`query_file!`][`crate::query_file!`] which does not check the input or output
/// the query to ensure it's syntactically and semantically valid for the current database. /// types. This still does parse the query to ensure it's syntactically and semantically valid
/// for the current database.
#[macro_export] #[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
macro_rules! query_file_unchecked ( macro_rules! query_file_unchecked (
@ -408,7 +409,8 @@ macro_rules! query_file_unchecked (
}) })
); );
/// A variant of [query!] which takes a path to an explicitly defined struct as the output type. /// A variant of [`query!`][`crate::query!`] which takes a path to an explicitly defined struct
/// as the output type.
/// ///
/// This lets you return the struct from a function or add your own trait implementations. /// This lets you return the struct from a function or add your own trait implementations.
/// ///
@ -483,7 +485,8 @@ macro_rules! query_file_unchecked (
/// (`.execute()` is omitted as this macro requires at least one column to be returned.) /// (`.execute()` is omitted as this macro requires at least one column to be returned.)
/// ///
/// ### Column Type Override: Infer from Struct Field /// ### Column Type Override: Infer from Struct Field
/// In addition to the column type overrides supported by [query!], `query_as!()` supports an /// In addition to the column type overrides supported by [`query!`][`crate::query!`],
/// [`query_as!()`][`crate::query_as!`] supports an
/// additional override option: /// additional override option:
/// ///
/// If you select a column `foo as "foo: _"` (Postgres/SQLite) or `` foo as `foo: _` `` (MySQL) /// If you select a column `foo as "foo: _"` (Postgres/SQLite) or `` foo as `foo: _` `` (MySQL)
@ -558,7 +561,8 @@ macro_rules! query_file_unchecked (
/// `select id as "id!"` to override the inferred nullability because we know in practice /// `select id as "id!"` to override the inferred nullability because we know in practice
/// that column will never be `NULL` and it will fix the error. /// that column will never be `NULL` and it will fix the error.
/// ///
/// Nullability inference and type overrides are discussed in detail in the docs for [query!]. /// Nullability inference and type overrides are discussed in detail in the docs for
/// [`query!`][`crate::query!`].
/// ///
/// It unfortunately doesn't appear to be possible right now to make the error specifically mention /// It unfortunately doesn't appear to be possible right now to make the error specifically mention
/// the field; this probably requires the `const-panic` feature (still unstable as of Rust 1.45). /// the field; this probably requires the `const-panic` feature (still unstable as of Rust 1.45).
@ -573,7 +577,7 @@ macro_rules! query_as (
}) })
); );
/// Combines the syntaxes of [query_as!] and [query_file!]. /// Combines the syntaxes of [`query_as!`][`crate::query_as!`] and [`query_file!`][`crate::query_file!`].
/// ///
/// Enforces requirements of both macros; see them for details. /// Enforces requirements of both macros; see them for details.
/// ///
@ -617,7 +621,7 @@ macro_rules! query_file_as (
}) })
); );
/// A variant of [query_as!] which does not check the input or output types. This still does parse /// A variant of [`query_as!`][`crate::query_as!`] which does not check the input or output types. This still does parse
/// the query to ensure it's syntactically and semantically valid for the current database. /// the query to ensure it's syntactically and semantically valid for the current database.
#[macro_export] #[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
@ -631,7 +635,7 @@ macro_rules! query_as_unchecked (
}) })
); );
/// A variant of [query_file_as!] which does not check the input or output types. This /// A variant of [`query_file_as!`][`crate::query_file_as!`] which does not check the input or output types. This
/// still does parse the query to ensure it's syntactically and semantically valid /// still does parse the query to ensure it's syntactically and semantically valid
/// for the current database. /// for the current database.
#[macro_export] #[macro_export]
@ -646,7 +650,7 @@ macro_rules! query_file_as_unchecked (
}) })
); );
/// A variant of [query!] which expects a single column from the query and evaluates to an /// A variant of [`query!`][`crate::query!`] which expects a single column from the query and evaluates to an
/// instance of [QueryScalar][crate::query::QueryScalar]. /// instance of [QueryScalar][crate::query::QueryScalar].
/// ///
/// The name of the column is not required to be a valid Rust identifier, however you can still /// The name of the column is not required to be a valid Rust identifier, however you can still
@ -656,10 +660,10 @@ macro_rules! query_file_as_unchecked (
/// getting a different type than expected, please check to see if your override syntax is correct /// getting a different type than expected, please check to see if your override syntax is correct
/// before opening an issue.** /// before opening an issue.**
/// ///
/// Wildcard overrides like in [query_as!] are also allowed, in which case the output type /// Wildcard overrides like in [`query_as!`][`crate::query_as!`] are also allowed, in which case the output type
/// is left up to inference. /// is left up to inference.
/// ///
/// See [query!] for more information. /// See [`query!`][`crate::query!`] for more information.
#[macro_export] #[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
macro_rules! query_scalar ( macro_rules! query_scalar (
@ -671,7 +675,8 @@ macro_rules! query_scalar (
) )
); );
/// A variant of [query_scalar!] which takes a file path like [query_file!]. /// A variant of [`query_scalar!`][`crate::query_scalar!`] which takes a file path like
/// [`query_file!`][`crate::query_file!`].
#[macro_export] #[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
macro_rules! query_file_scalar ( macro_rules! query_file_scalar (
@ -683,8 +688,9 @@ macro_rules! query_file_scalar (
) )
); );
/// A variant of [query_scalar!] which does not typecheck bind parameters and leaves the output type /// A variant of [`query_scalar!`][`crate::query_scalar!`] which does not typecheck bind parameters
/// to inference. The query itself is still checked that it is syntactically and semantically /// 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 /// valid for the database, that it only produces one column and that the number of bind parameters
/// is correct. /// is correct.
/// ///
@ -700,8 +706,9 @@ macro_rules! query_scalar_unchecked (
) )
); );
/// A variant of [query_file_scalar!] which does not typecheck bind parameters and leaves the output /// A variant of [`query_file_scalar!`][`crate::query_file_scalar!`] which does not typecheck bind
/// type to inference. The query itself is still checked that it is syntactically and /// 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 /// semantically valid for the database, that it only produces one column and that the number of
/// bind parameters is correct. /// bind parameters is correct.
/// ///