mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00
chore(doc): clarify compile-time verification and case conversion behavior (#3866)
* chore(doc): clarify compile-time verification and case conversion behavior * apply review suggestions Co-authored-by: Austin Bonander <austin.bonander@gmail.com> * fix(fmt): remove trailing spaces * fix(doc): links --------- Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
This commit is contained in:
parent
92c3845952
commit
1b94e1d07d
@ -65,6 +65,14 @@ use crate::{error::Error, row::Row};
|
||||
/// reason), `lowercase`, `UPPERCASE`, `camelCase`, `PascalCase`, `SCREAMING_SNAKE_CASE` and `kebab-case`.
|
||||
/// The styling of each option is intended to be an example of its behavior.
|
||||
///
|
||||
/// Case conversion is handled by the `heck` crate.
|
||||
/// See [its documentation](https://docs.rs/heck/0.5.0/heck/#definition-of-a-word-boundary)
|
||||
/// for details.
|
||||
///
|
||||
/// Note that numbers are *not* considered separate words.
|
||||
/// For example, `Foo1` to snake case would be `foo1`, *not* `foo_1`.
|
||||
/// See [this issue](https://github.com/launchbadge/sqlx/issues/3864) for discussion.
|
||||
///
|
||||
/// #### `default`
|
||||
///
|
||||
/// When your struct contains a field that is not present in your query,
|
||||
|
@ -99,8 +99,11 @@ pub use bstr::{BStr, BString};
|
||||
///
|
||||
/// ## Compile-time verification
|
||||
///
|
||||
/// With compile-time verification, the use of type overrides is currently required to make
|
||||
/// use of any user-defined types.
|
||||
/// Type definitions are *not* verified against the database at compile-time.
|
||||
/// The [`query!()`](macro.query.html) macros have no implicit knowledge of user-defined types.
|
||||
///
|
||||
/// When using custom types in query parameters or output columns with `query!()`,
|
||||
/// the use of [type overrides](macro.query.html#type-overrides-bind-parameters-postgres-only) is required.
|
||||
///
|
||||
/// ```rust,ignore
|
||||
/// struct MyUser { id: UserId, name: String }
|
||||
|
@ -249,7 +249,7 @@
|
||||
///
|
||||
/// ##### Force a Different/Custom Type
|
||||
/// Selecting a column `foo as "foo: T"` (Postgres / SQLite) or `` foo as `foo: T` `` (MySQL)
|
||||
/// overrides the inferred type which is useful when selecting user-defined custom types
|
||||
/// overrides the inferred type which is useful when selecting user-defined [custom types][crate::Type#compile-time-verification]
|
||||
/// (dynamic type checking is still done so if the types are incompatible this will be an error
|
||||
/// at runtime instead of compile-time). Note that this syntax alone doesn't override inferred nullability,
|
||||
/// but it is compatible with the forced not-null and forced nullable annotations:
|
||||
|
Loading…
x
Reference in New Issue
Block a user