Selecto.Output.TypeCoercion
(Selecto v0.4.5)
Copy Markdown
Database type coercion system for transforming raw database values to appropriate Elixir types based on PostgreSQL column types.
This module provides configurable type coercion strategies and can be extended to support custom type mappings and coercion functions.
Summary
Functions
Batch coerce a list of values with their corresponding column types.
Coerce a database value to its appropriate Elixir type.
Get the Elixir type for a given PostgreSQL column type.
Get all supported PostgreSQL type mappings.
Functions
Batch coerce a list of values with their corresponding column types.
This is more efficient than coercing values one by one when you have column type information for all values.
Coerce a database value to its appropriate Elixir type.
Parameters
value- The raw database valuecolumn_type- The PostgreSQL column type (optional)strategy- Coercion strategy (:strict, :safe, :ignore, :custom)custom_coercions- Map of custom coercion functions
Coercion Strategies
:strict- Raise on coercion errors:safe- Return original value on coercion errors:ignore- Skip coercion, return raw values:custom- Use custom coercion functions
Get the Elixir type for a given PostgreSQL column type.
Get all supported PostgreSQL type mappings.