Coercing and validating user input can lead to painful code. Casting language primitives is done by Ecto, and storage problems that once required thought are solved by convention—time is stored in UTC, money without floating points. Managing our own types often gets ugly, though: standard vs metric; currency conversion; jsonb.
Extending Ecto is simple. With custom types, we can separate casting from formatting and dramatically improve the readability and maintainability of applications.
101. • Currencies have different scales and precisions
• Not all currencies are base 10
• You may not want to automatically convert between currencies,
depending on your business, your payment gateway(s),
your bank(s), etc
• When you convert currencies, you may want to store the
exchange rate at the time of the transfer
102.
103. Credits
Sparta Science
Aaron Graham
Abraham Choe
Andrew Aunelle
Diana Chou
Erik Hanson
Greg Woodward
Harold Tafur
Kelly Felkins
Jeff Rosen
Mark Sherwood
Nick Chaffee
https://www.amberbit.com/blog/2017/8/3/time-zones-
in-postgresql-elixir-and-phoenix/
https://unsplash.com
https://www.pexels.com
unattributed photos are attributable to me