Inspecto
Inspecto is a utility to facilitate the inspection of Ecto schemas (via reflection) to view the field names, data types, default values, etc.
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 Ectomigrations contain a lot more of this information, they too aren’t ideal 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.
Installation
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.4.0"}
]
endUsage
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)}
"""
endImage Attribution
Inspect by Musaplated from NounProject.com