defmodule Memex do @moduledoc """ Memex keeps the contexts that define your domain and business logic. Contexts are also responsible for managing your data, regardless if it comes from the database, an external API or others. """ def context do quote do use Gettext, backend: MemexWeb.Gettext import Ecto.Query alias Ecto.{Changeset, Multi, Queryable, UUID} alias Memex.Accounts.User alias Memex.Repo end end def schema do quote do use Ecto.Schema use Gettext, backend: MemexWeb.Gettext import Ecto.{Changeset, Query} alias Ecto.{Association, Changeset, Queryable, UUID} alias Memex.Accounts.User @primary_key {:id, :binary_id, autogenerate: true} @foreign_key_type :binary_id end end @doc """ When used, dispatch to the appropriate context/schema/etc. """ defmacro __using__(which) when is_atom(which) do apply(__MODULE__, which, []) end end