EctoAnon.Query (ecto_anon v0.6.2)

View Source

Summary

Functions

Returns a query that searches resources excluding anonymized ones

Functions

apply(data, repo, struct)

@spec apply(%{fields: List.t(), embeds: List.t()}, Ecto.Repo.t(), struct()) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
@spec apply(keyword(), Ecto.Repo.t(), struct()) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}

not_anonymized(query)

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

Returns a query that searches resources excluding anonymized ones

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

results = Repo.all(query)

set_anonymized(repo, struct)

@spec set_anonymized(Ecto.Repo.t(), struct()) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}