View Source API Reference KineticEcto v1.1.1

Modules

Documentation for KineticEcto.

Additional validations for use with Ecto.Changeset.

Add Saša Jurić's Repo.transact/2 to your repo with useKineticEcto.RepoTransact.Repo.transact/2is a replacement forRepo.transaction/2with a better developer experience. In many cases, the use ofRepo.transact/2can provide code that is easier to understand than an equivalentEcto.Multiimplementation. In Saša's own [words][1]: > I wroteRepo.transactafter seeing a lot of production code along the lines of what's > written in that excellent [blog post][2] by @tomkonidas. > > The value proposition ofRepo.transactis that control flow features such as passing > data around, branching, early exit, can be implemented with standard Elixir features, > such as variables, functions, and thewithexpression. The transactional logic is > less special, and it doesn't rely on some implicit behaviour of a function from some > library. > > Combined with the provable fact that thetransactcode is shorter (often > significantly), even in such simple example as in that blog post, I have no doubt that > thetransactversion is simpler and clearer. > > That's not to say thatMultiis universally bad. The ability to provide each db > operation as data is definitely interesting, and could be useful in the cases where > the transactional steps need to be assembled dynamically (perhaps provided by the > client code). But in the vast majority of cases I've encountered, I find the multi > code needlessly difficult to read. This is true even in simple cases, and it becomes > progressively worse if the transactional logic is more involved (e.g. if it requires > branching early on in the transaction). > > Hence, I strongly prefertransact`, and it's what I advise using in most situations. [1]: https://elixirforum.com/t/seeking-thoughts-on-advantages-of-the-repo-transact-pattern-vs-disadvantages-i-ve-read-about-ecto-multi/61733/2 [2]: https://tomkonidas.com/repo-transact/

This module has been renamed to KineticEcto.RepoTransact and will be removed in the next major release.