Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initial rough draft of a
PaperTrail.Multi
API that wrapsEcto.Multi
to allow creating multi step transactions using a pipeline.Inspiration taken from this ticket #48.
This PR extracts the logic from the
PaperTrail
module and breaks it down into transaction creation + committing steps inPaperTrail.Multi
. These functions provide the Multi API and are then reused withinPaperTrail
to implement the non-Multi
functions.Since even the non-
Multi
functions require a transaction to apply the paper trail logic, I thought this might be a nice approach.API wise, it's almost 1-to-1 with
Ecto.Multi
, the only exceptions are:delete_all
insert_all
insert_or_update
update_all
PaperTrail.Multi.commit
instead of simply callingRepo.transaction
on the multi chain.There is no tests or documentation, but the existing tests pass fully which I think makes a good smoke test as
insert
,update
, anddelete
are re-implemented using theMulti
-api.I figured I would open this now and see if I'm barking up the right tree here, and if so I will continue to add tests and documentation around the feature.