EctoInterface (ecto_interface v4.2.0)

EctoInterface is a suite of commonly defined APIs for Ecto-based models. Almost all of these came from the normal generated content in a new phoenix project, simply unifying and expanding on that suite.

Summary

Functions

Using this expression in your context module

Functions

__using__(options)

(macro)

Using this expression in your context module:

use(EctoInterface, source: Core.Commerce.Product, plural: :products, :product])

Will automatically define a whole suite of functions for that schema.

You can also get specific about which changesets are used (default is schema.changeset/2):

use(EctoInterface, source: Core.Commerce.Product, plural: :products, :product, changeset: :simple_changeset])

And also if you need to differentiate between insert and update changesets:

use(EctoInterface, source: Core.Commerce.Product, plural: :products, :product, insert_by: :create_changeset, update_by: :update_changeset])