Skip to content

Commit

Permalink
add some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nduitz committed Jul 6, 2020
1 parent 4d4ebbf commit ccdcd10
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/repo/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ defmodule ExAudit.Repo do
delete!: 2
)

@doc """
Decides based on config `tracked_schema` wether the current schema is tracked or not.
Can be overwritten for custom tracking logic.
E.g.
```
def tracked?(struct_or_schema) do
tracked? =
case Process.get(__MODULE__) do
%{tracked?: true} -> true
_ -> false
end
tracked? && super(struct_or_schema)
end
```
"""
def tracked?(struct_or_changeset) do
tracked_schemas = Application.get_env(:ex_audit, :tracked_schemas, [])

Expand Down

0 comments on commit ccdcd10

Please sign in to comment.