Bylaw.Ecto.Schema (bylaw_postgres v0.1.0-alpha.1)

Copy Markdown View Source

Reflection helpers for compiled Ecto schema modules.

These helpers intentionally inspect compiled modules instead of source code. Projects commonly wrap use Ecto.Schema in their own macros, so source-based detection would miss valid schemas.

Summary

Types

Compiled schema metadata needed by database checks.

Functions

Returns true when module exports Ecto schema reflection functions.

Returns compiled schema metadata.

Returns compiled Ecto schema modules for an OTP application.

Types

info()

@type info() :: %{
  module: module(),
  source: String.t(),
  prefix: String.t() | nil,
  fields: [atom()],
  associations: [atom()],
  field_sources: %{required(String.t()) => atom()}
}

Compiled schema metadata needed by database checks.

Functions

ecto_schema?(module)

@spec ecto_schema?(module :: module()) :: boolean()

Returns true when module exports Ecto schema reflection functions.

info(module)

@spec info(module :: module()) :: info()

Returns compiled schema metadata.

modules(otp_app)

@spec modules(otp_app :: atom()) :: [module()]

Returns compiled Ecto schema modules for an OTP application.