soft_delete_helper_module v0.0.1 SoftDeleteHelperModule.Schema
Contains schema macros to add soft delete fields to a schema
Link to this section Summary
Functions
Marks a row deleted when passed its specific struct pertaining to any table
Adds the deleted_at and is_deleted columns to a schema
Adds where clause to the query for non soft deleted rows
Link to this section Functions
Link to this function
delete_entity(struct)
Marks a row deleted when passed its specific struct pertaining to any table
Returns the changeset for soft deleted row The user just need to update it using Repo.update(changeset)
Parameters
- struct: Entity for DB
Link to this macro
soft_delete_schema() (macro)
Adds the deleted_at and is_deleted columns to a schema
defmodule User do
use Ecto.Schema
import SoftDeleteHelperModule.Schema
schema "users" do
field :first_name, :string
soft_delete_schema()
end
end
Link to this function
with_non_soft_delete(query)
Adds where clause to the query for non soft deleted rows
Parameters
- query: ecto query