An Elixir utility for inspecting Ecto database schemas
APACHE-2.0 License
Inspecto
is a utility for inspecting Ecto schemas to view the field names,
data types, and default values.
Note that Ecto schema modules do not contain full information about your database schemas: they only contain enough information to act as a viable intermediary for the Elixir layer. You cannot, for example, know character length limits or input constraints by merely inspecting Ecto schemas. Although Ecto migrations contain a lot more of this information, they too aren't great for the purpose because (by design) migrations are additive with changes spread out over time, and importantly, there is no requirement that a database be defined via migrations! So Inspecto
attempts to provide insight into what it can.
If available in Hex, the package can be installed
by adding inspecto
to your list of dependencies in mix.exs
:
def deps do
[
{:inspecto, "~> 0.1.0"}
]
end
The envisioned usage of this package is to call it from within one of your application's @moduledoc
tags, e.g.
defmodule MyApp.MyModel do
@moduledoc """
Here is a summary of my Ecto schemas:
#{ MyApp.MyModel |> Inspecto.modules() |> Inspecto.summarize(format: :html)}
"""
end
Inspect by Musaplated from NounProject.com