Adding Custom Types Without the Built-In Types
So far, the custom types we’ve created have been built on the types already included in Ecto. By adding a layer on top of a built-in type, we can have richer data types in our Elixir code than we’d have just using the standard database types.
However, if you want to work with a data type that is not currently supported in Ecto, you’ll need to go a little deeper and write your own driver extension. To better understand how that might work, let’s take a closer look at how data moves from your Elixir code to the database and back, as shown in this figure:
We start at the database, where the raw data ...
Get Programming Ecto now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.