mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
docs: add a docstring for expr_sort
This commit is contained in:
parent
250c4ab8c8
commit
db7e42713c
1 changed files with 12 additions and 0 deletions
|
@ -24,6 +24,18 @@ defmodule Ash.Sort do
|
|||
|
||||
alias Ash.Error.Query.{InvalidSortOrder, NoSuchAttribute}
|
||||
|
||||
@doc """
|
||||
Builds an expression to be used in a sort statement.
|
||||
|
||||
For example:
|
||||
|
||||
```elixir
|
||||
Ash.Query.sort(Ash.Sort.expr_sort(author.full_name))
|
||||
|
||||
Ash.Query.sort([{Ash.Sort.expr_sort(author.full_name), :desc_nils_first}])
|
||||
```
|
||||
"""
|
||||
@spec expr_sort(Ash.Expr.t(), Ash.Type.t() | nil) :: Ash.Expr.t()
|
||||
defmacro expr_sort(expression, type \\ nil) do
|
||||
quote do
|
||||
require Ash.Expr
|
||||
|
|
Loading…
Reference in a new issue