CodeStory.QueryLabel (CodeStory v0.2.0)

Copy Markdown View Source

Compact, framed label for an Ecto.Query value — e.g. #Ecto.Query<Confab.Registration.Registration> — so a query argument in a trace reads as the schema it queries instead of a verbose from … where … order_by … dump.

Detection is value-shaped and dependency-free: Ecto.Query/Ecto.SubQuery are matched only as atom literals (%{__struct__: Ecto.Query}), which compile without Ecto being available. label/1 returns nil for any non-query value, so callers can fall through to normal inspection.

Known limitation

Only a top-level query value is labelled — a query nested inside a map/list argument still inspects verbosely. Boundary arguments are top-level, so this covers the common case.

Summary

Functions

label(arg1)

@spec label(term()) :: String.t() | nil