So far, the custom types we’ve created have been built on the types already included in Ecto. When we add 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.

Write the driver extension

However, if we want to work with a data type not currently supported in Ecto, we’ll need to go into a little more detail and write our driver extension.

To better understand how that might work, let’s take a closer look at how data moves from our Elixir code to the database and back, as shown in this figure.

Get hands-on with 1200+ tech skills courses.