View Source QueryStats (query_stats v0.1.1)

QueryStats is a library that provides a way to track the number of queries executed by Ecto during test suite runs.

After a run, it will output the total number of queries and the number of queries per type.

Installation

Add query_stats to your list of dependencies in mix.exs:

def deps do
  [
    {:query_stats, "~> 0.1", only: :test}
  ]
end

Then, in your test_helper.exs file, add the following line:

QueryStats.start(:my_app)

Replace :my_app with the name of your application.

Output example

Total queries: 10
Query types:
  INSERT: 5
  SELECT: 5

Summary

Functions

Starts the QueryStats library.

Functions

@spec start(atom()) :: :ok

Starts the QueryStats library.

Examples

iex> QueryStats.start(:my_app) :ok