View Source API Reference ecto_forge v0.1.20
Modules
!!!!! 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
You can use callback functions for processing. After the query and before the query to filter the data.
You can use callback functions for processing. After the query and before the query to filter the data. module MyApp.UserModel -> your own module mode -> :all or :one query -> handled query repo -> MyApp.Repo list_exetensions_executed -> Executed list of extensions attrs -> attributes that fall
Create your instanse EctoForge and use for your context or Models
This module creates an instance with functions from EctoForge.DatabaseApi
Implements base functions for database
use(
EctoForge.DatabaseApi,
[
repo: MyApp.Repo, # required param
extensions_get: [], # default list
extensions_events: [], # default list
extensions_events_additional: [], # this don't rewrite extensions_get when you use EctoForge.Instanse
extensions_get_additional: [], # this don't rewrite extensions_get when you use EctoForge.Instanse
]
)
addinotal
if you use through use EctoForge.CreateInstance
when not found repo in EctoForge.DatabaseApi
Default extension for ecto_forge
This module generate logger to yours models or contextes with cusom message
This macros for use EctoForge.Extension.Events.Logger.DefaultLogger
more information in there module
Implements library https://hexdocs.pm/filtery/readme.html
use EctoForge.CreateInstance,
extensions_get: [
EctoForge.Extension.Get.Filter,
],
repo: MyApp.Repo
## When you coonnect You can use Api https://hexdocs.pm/filtery/readme.html ### Example
raise if you didn't pass on %{filter: %{}} in find_all
find
get_all
get!
get_all!
Use last with your EctoForge.CreateInstance
use EctoForge.CreateInstance,
extensions_get: [
EctoForge.Extension.Get.Last,
],
repo: MyApp.Repo
## When you coonnect You can use Api https://hexdocs.pm/ecto/Ecto.Query.html#last/2 ### Example
Use limit with your EctoForge.CreateInstance
use EctoForge.CreateInstance,
extensions_get: [
EctoForge.Extension.Get.Limit,
],
repo: MyApp.Repo
## When you coonnect You can use Api https://hexdocs.pm/ecto/Ecto.Query.html#limit/3 ### Example
Use with your EctoForge.CreateInstance
use EctoForge.CreateInstance,
extensions_get: [
EctoForge.Extension.Get.OnlyQuery,
],
repo: MyApp.Repo
## When you coonnect You can get only query with your find_all get_all find ### Example
Use with your EctoForge.CreateInstance
use EctoForge.CreateInstance,
extensions_get: [
EctoForge.Extension.Get.OrderBy,
],
repo: MyApp.Repo
## When you coonnect You can use Api https://hexdocs.pm/ecto/Ecto.Query.html#order_by/3 ### Example
Paginate your Model
conect to your instanse
use EctoForge.CreateInstance,
extensions_get: [
EctoForge.Extension.Get.Pagination,
],
repo: MyApp.Repo
Example
{:ok, %{count_data: 30, data: list}} = MyApp.Model.get_all(%{pagination: %{page: 1}})
{:ok, %{count_data: 30, data: list}} = MyApp.Model.get_all(%{pagination: %{page: 2, limit: 5}})
Use with your EctoForge.CreateInstance
use EctoForge.CreateInstance,
extensions_get: [
EctoForge.Extension.Get.Select,
],
repo: MyApp.Repo
## When you coonnect You can select yours fields ### Example
The helper module is used to perform an extension for the find_all
get_all
get!()
get!
functions.
You can use and create your binder