mirror of
https://github.com/diesel-rs/diesel.git
synced 2024-10-04 01:28:13 +03:00
Add docs for sql function without arguments
Add v1.4 upgrade comment to the CHANGELOG nodes
This commit is contained in:
parent
8a7068323c
commit
098554df84
@ -213,6 +213,10 @@ Key points:
|
||||
NonAggregate` no longer implies `(OtherType, T): NonAggregate`.
|
||||
- With `feature = "unstable"`, `(T, OtherType): NonAggregate` is still implied.
|
||||
|
||||
- In diesel v1.4 sql functions without arguments used the `no_arg_sql_function!` macro,
|
||||
which has since been deprecated. The new `sql_function!` macro supports functions without
|
||||
arguments.
|
||||
|
||||
[2-0-migration]: FIXME write a migration guide
|
||||
|
||||
## [1.4.5] - 2020-06-09
|
||||
|
@ -863,6 +863,25 @@ pub fn derive_valid_grouping(input: TokenStream) -> TokenStream {
|
||||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// # SQL Functions without Arguments
|
||||
///
|
||||
/// A common example is ordering a query using the `RANDOM()` sql function,
|
||||
/// which can be implemented using `sql_function!` like this:
|
||||
///
|
||||
/// ```rust
|
||||
/// # extern crate diesel;
|
||||
/// # use diesel::*;
|
||||
/// #
|
||||
/// # table! { crates { id -> Integer, name -> VarChar, } }
|
||||
/// #
|
||||
/// sql_function!(fn random() -> Text);
|
||||
///
|
||||
/// # fn main() {
|
||||
/// # use self::crates::dsl::*;
|
||||
/// crates.order(random());
|
||||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// # Use with SQLite
|
||||
///
|
||||
/// On most backends, the implementation of the function is defined in a
|
||||
|
Loading…
Reference in New Issue
Block a user