Trash.Query.select_trashable
You're seeing just the function
select_trashable
, go back to Trash.Query module for more information.
Link to this function
select_trashable(queryable)
Specs
select_trashable(queryable :: Ecto.Queryable.t()) :: Ecto.Queryable.t()
Adds trashable fields to select.
This ensures that both trashable fields are included in the select statement
by using Ecto.Query.select_merge/3
to merge in the fields.
For a list of the current trashable fields, see
Trash.Schema.trashable_fields/0
.
This loads discarded_at
from the database and computes the boolean for
discarded?
from the SQL expression discarded_at IS NOT NULL
.
Note: Since discarded?
is a virtual field, without using this function,
it'll be nil
by default.
Examples
iex> Trash.Query.select_trashable(Post) |> Repo.all()
[%Post{title: "Hello World", discarded_at: %DateTime{}, discarded?: true}]
iex> Trash.Query.select_trashable(Post) |> Repo.all()
[%Post{title: "Hello World", discarded_at: nil, discarded?: false}]