Ecto.SoftDelete.Query (ecto_soft_delete v2.1.0)

functions for querying data that is (or is not) soft deleted

Summary

Functions

Returns true if the schema is not flagged to skip auto-filtering

Returns true if the query is soft deletable, false otherwise.

Returns a query that searches only for undeleted items

Functions

Link to this function

auto_include_deleted_at_clause?(query)

@spec auto_include_deleted_at_clause?(Ecto.Queriable.t()) :: boolean()

Returns true if the schema is not flagged to skip auto-filtering

Link to this function

soft_deletable?(query)

@spec soft_deletable?(Ecto.Queryable.t()) :: boolean()

Returns true if the query is soft deletable, false otherwise.

query = from(u in User, select: u)
|> soft_deletable?
Link to this function

with_undeleted(query)

@spec with_undeleted(Ecto.Queryable.t()) :: Ecto.Queryable.t()

Returns a query that searches only for undeleted items

query = from(u in User, select: u)
|> with_undeleted

results = Repo.all(query)