View Source SchemaAssertions.Schema (Schema Assertions v0.2.0)

Ecto schema introspection

Link to this section Summary

Functions

Returns true if the given module has a belongs_to relationship

Returns true if the given module is an Ecto schema

Returns :ok if the schema has a has_many relationship

Returns :ok if the schema has a has_one relationship

Returns true if the given module exists

Returns the database table name for the given module

Link to this section Functions

Link to this function

belongs_to?(module, assoc_name, assoc_module)

View Source

Specs

belongs_to?(module(), atom(), module()) :: :ok | {:error, String.t()}

Returns true if the given module has a belongs_to relationship

Specs

ecto_schema?(module()) :: boolean()

Returns true if the given module is an Ecto schema

Link to this function

has_many?(module, assoc_name, assoc_module_or_options)

View Source

Specs

has_many?(module(), atom(), module() | Keyword.t()) ::
  :ok | {:error, atom(), String.t()}

Returns :ok if the schema has a has_many relationship

Link to this function

has_one?(module, assoc_name, assoc_module)

View Source

Specs

has_one?(module(), atom(), module()) :: :ok | {:error, String.t()}

Returns :ok if the schema has a has_one relationship

Specs

module_exists?(module()) :: boolean()

Returns true if the given module exists

Specs

table_name(module()) :: binary()

Returns the database table name for the given module