Skip to content

Commit

Permalink
Fix several inter doc links (#2954)
Browse files Browse the repository at this point in the history
  • Loading branch information
ralpha authored May 31, 2024
1 parent f960d5b commit 240b4ff
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 27 deletions.
4 changes: 3 additions & 1 deletion src/any/install_drivers_note.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ The underlying database drivers are chosen at runtime from the list set via
without this will panic.

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
2 changes: 2 additions & 0 deletions src/any/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub(crate) mod reexports {
///
/// ### Panics
/// If [`install_drivers`] has already been called *not* through this function.
///
/// [`AnyConnection`]: sqlx_core::any::AnyConnection
pub fn install_default_drivers() {
static ONCE: Once = Once::new();

Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ pub use sqlx_core::rt as __rt;
/// * Postgres: [postgres::types]
/// * MySQL: [mysql::types]
/// * SQLite: [sqlite::types]
/// * MSSQL: [mssql::types]
///
/// 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
Expand All @@ -112,7 +111,7 @@ pub mod types {
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 use sqlx_core::encode::{Encode, IsNull};

Expand All @@ -123,7 +122,7 @@ pub mod 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 use sqlx_core::decode::Decode;

Expand Down
53 changes: 30 additions & 23 deletions src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@
/// See [the README for `sqlx-cli`](https://crates.io/crates/sqlx-cli) for more information.
///
/// ## See Also
/// * [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_as!] if you want both of the above.
/// * [`query_as!`][`crate::query_as!`] if you want to use a struct you can name,
/// * [`query_file!`][`crate::query_file!`] if you want to define the SQL query out-of-line,
/// * [`query_file_as!`][`crate::query_file_as!`] if you want both of the above.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
macro_rules! query (
Expand All @@ -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.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
Expand All @@ -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.
///
/// The syntax and requirements (see [query!]) are the same except the SQL string is replaced by a
/// file path.
/// The syntax and requirements (see [`query!`][`crate::query!`]) are the same except the SQL
/// string is replaced by a file path.
///
/// 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
Expand Down Expand Up @@ -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
/// the query to ensure it's syntactically and semantically valid for the current database.
/// A variant of [`query_file!`][`crate::query_file!`] 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.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
macro_rules! query_file_unchecked (
Expand All @@ -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.
///
Expand Down Expand Up @@ -483,7 +485,8 @@ macro_rules! query_file_unchecked (
/// (`.execute()` is omitted as this macro requires at least one column to be returned.)
///
/// ### 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:
///
/// If you select a column `foo as "foo: _"` (Postgres/SQLite) or `` foo as `foo: _` `` (MySQL)
Expand Down Expand Up @@ -558,7 +561,8 @@ macro_rules! query_file_unchecked (
/// `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.
///
/// 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
/// the field; this probably requires the `const-panic` feature (still unstable as of Rust 1.45).
Expand All @@ -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.
///
Expand Down Expand Up @@ -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.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
Expand All @@ -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
/// for the current database.
#[macro_export]
Expand All @@ -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].
///
/// The name of the column is not required to be a valid Rust identifier, however you can still
Expand All @@ -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
/// 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.
///
/// See [query!] for more information.
/// See [`query!`][`crate::query!`] for more information.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
macro_rules! query_scalar (
Expand All @@ -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]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
macro_rules! query_file_scalar (
Expand All @@ -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
/// to inference. The query itself is still checked that it is syntactically and semantically
/// A variant of [`query_scalar!`][`crate::query_scalar!`] 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.
///
Expand All @@ -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
/// type to inference. The query itself is still checked that it is syntactically and
/// A variant of [`query_file_scalar!`][`crate::query_file_scalar!`] 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.
///
Expand Down

0 comments on commit 240b4ff

Please sign in to comment.