View Source EctoForge.CreateExtension.Events behaviour (ecto_forge v0.1.15)

!!!!! THIS MODULE IS DEVELOP,EXPEREMINTAL USING !!!!!!!!

This module allows you to catch Events using callback functions.

Using

Create your callbacks with EctoForge.CreateExtension.Events

defmodule Test.Event.ExtensionDeleteId do
use EctoForge.CreateExtension.Events

def after_get(result) do
  result |> Map.delete(:password)
end

def after_created({:ok, item}) do
  {:ok, item |> Map.delete(:password)}
end
end

Connect to your instansr or DataBaseApi

use EctoForge.CreateInstance,
  extensions_events: [MyApp.EctoForge.PasswordDeleter],
  repo: MyApp.Repo

Summary

Callbacks

@callback after_created(any()) :: any()
@callback after_created!(any()) :: any()
@callback after_deleted(any()) :: any()
@callback after_deleted!(any()) :: any()
@callback after_get(any()) :: any()
@callback after_updated(any()) :: any()
@callback after_updated!(any()) :: any()
@callback before_created(any()) :: any()
@callback before_created!(any()) :: any()
@callback before_deleted(any()) :: any()
@callback before_deleted!(any()) :: any()
@callback before_updated(any()) :: any()
@callback before_updated!(any()) :: any()