View Source EctoForge.Extension.Get.Aggregate (ecto_forge v0.1.20)

Use aggregate with your model

When you using this module your functions find get_all returns 0

Usage

use EctoForge.CreateInstance,
  extensions_get: [
    EctoForge.Extension.Get.Aggregate,
  ],
  repo: MyApp.Repo

Using with model functions get get_all find_all find

iex -> MyApp.Model.get_all!(%{filter: %{status: "active"}, aggregate: %{field: :id, aggregate: :count, opts: []}})
0

Recomidation

Use at the very end after used extensions because this extension instantly stops the others

Summary

Functions

After with result Handle your functions find_all get_all get! get find before You can use {:stop, query, attrs} -> Don't execute another extensions before

Before with your query Handle your functions find_all get_all get! get find before

Functions

Link to this function

after_query_add_extension_to_get(module, mode, repo, list_exetensions_executed, prev_query, result, attrs)

View Source

After with result Handle your functions find_all get_all get! get find before You can use {:stop, query, attrs} -> Don't execute another extensions before

Link to this function

before_query_add_extension_to_get(module, mode, repo, list_exetensions_executed, query, attrs)

View Source

Before with your query Handle your functions find_all get_all get! get find before

return {query, attrs} # required to return

You can use {:stop, query, attrs} -> Don't execute another extensions before You can use {:reusult, result, attrs} -> Don't execute repo extensions before