Add docs for sql function without arguments

Add v1.4 upgrade comment to the CHANGELOG nodes
This commit is contained in:
Garrett Thornburg 2020-10-11 21:43:48 -07:00
parent 8a7068323c
commit 098554df84
2 changed files with 23 additions and 0 deletions

View File

@ -213,6 +213,10 @@ Key points:
NonAggregate` no longer implies `(OtherType, T): NonAggregate`. NonAggregate` no longer implies `(OtherType, T): NonAggregate`.
- With `feature = "unstable"`, `(T, OtherType): NonAggregate` is still implied. - 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 [2-0-migration]: FIXME write a migration guide
## [1.4.5] - 2020-06-09 ## [1.4.5] - 2020-06-09

View File

@ -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 /// # Use with SQLite
/// ///
/// On most backends, the implementation of the function is defined in a /// On most backends, the implementation of the function is defined in a