Lower-level Repo integration behind use Lazarus.
Most applications should use Lazarus rather than referencing this module
directly. This module primarily exists to implement and document the
repo-specific hooks that power use Lazarus.
The functions documented below are injected into your Repo module when you
call use Lazarus. In other words, this module is the reference for the
Repo.update* behavior that skips soft-deleted rows plus the
Repo.soft_delete* and Repo.hard_delete* APIs, even though those functions
ultimately live on your own Repo module.
What use Lazarus adds to a Repo
Repo.update*, loadedRepo.insert_or_update*, andRepo.update_all/3behavior that skips soft-deleted rows unlesswith_deleted: trueis passedRepo.soft_delete/2andRepo.soft_delete!/2for single-row soft deletesRepo.soft_delete_all/2for bulk soft deletesRepo.hard_delete/2,Repo.hard_delete!/2, andRepo.hard_delete_all/2as explicit hard-delete escape hatches- protection against accidental
Repo.delete*andRepo.delete_all*calls - a
prepare_query/3callback that filters soft-deleted rows from reads and bulk updates unlesswith_deleted: trueis passed - protection against raw SQL unless
allow_raw_sql: trueis passed - protection against schema-less sources unless
allow_schema_less_sources: trueis passed - composition with any Repo-defined
prepare_query/3, with Lazarus running after the Repo callback and respecting options such aswith_deleted: true
use options
:bypass_schemas- schemas that should keep ordinaryupdate*,delete*,update_all, anddelete_all*behavior, and skip read and update filtering:bypass_tables- schema-less table names that should keep ordinaryupdate_allanddelete_all*behavior and skip read and update raw-source filtering
Example
defmodule MyApp.Repo do
use Ecto.Repo, otp_app: :my_app, adapter: Ecto.Adapters.Postgres
use Lazarus
endMost users will want the README plus the "Repo Module Setup", "Fetch, Update, and Delete APIs", "Query Support", "Cascade Soft-Deletes", and "Assoc Replace" guides for end-to-end usage. This module is better read as API reference for repo-level behavior.