View Source Introspex.Postgres.TypeMapper (Introspex v0.2.0)

Maps PostgreSQL data types to Ecto schema types.

Summary

Functions

Determines if a field is an Ecto timestamp field. Ecto specifically expects "inserted_at" and "updated_at" for the timestamps() macro. This is not domain-specific but rather an Ecto framework convention.

Checks if columns are compatible with Ecto's timestamps() macro. Returns true only if both inserted_at and updated_at exist with compatible types.

Maps a PostgreSQL data type string to an Ecto type atom or tuple.

Returns a list of supported PostGIS types that require special handling.

Checks if a type requires a special import or alias.

Returns the Ecto field type definition as a string for code generation.

Functions

Link to this function

ecto_timestamp_field?(field_name)

View Source

Determines if a field is an Ecto timestamp field. Ecto specifically expects "inserted_at" and "updated_at" for the timestamps() macro. This is not domain-specific but rather an Ecto framework convention.

Link to this function

ecto_timestamps_compatible?(columns)

View Source

Checks if columns are compatible with Ecto's timestamps() macro. Returns true only if both inserted_at and updated_at exist with compatible types.

Link to this function

map_type(postgres_type, enum_values \\ nil, opts \\ [])

View Source

Maps a PostgreSQL data type string to an Ecto type atom or tuple.

Returns a list of supported PostGIS types that require special handling.

Link to this function

requires_special_import?(type)

View Source

Checks if a type requires a special import or alias.

Returns the Ecto field type definition as a string for code generation.