kip
Ex_money - feedback and request for comments
ex_money is a lib I maintain to provide functions on and serialisation of a structured money type. It is driven by the currency definitions in the Unicode CLDR as implemented by ex_cldr.
My aim to drive to a stable 1.0 release by the end of the year. By that time CLDR release 32 will be out and ex_money will have been in the wild for several months without - so far - any material public API changes.
This post is to solicit any feedback, suggestions, concerns or issues that could contribute to the packages evolution and to the goal of a stable and production standard 1.0 release by the end of the year.
The README gives a reasonable introduction to functions and motivations. The code is available on GitHub.
Feel free to respond here. Or perhaps more appropriately open an issue on Github.
Most Liked
kip
I would say the main difference is that ex_money is driven by the CLDR repository and therefore supports all defined 516 locales, all ISO4217 currencies; knows the correct rounding required for each currency (cash and transaction amounts) and knows how to format in a locale-specific way.
The second difference is the provision of an Ecto composite type for Postgres (and a lesser implementation for MySQL) to aid serialisation and preserve precision.
Of course none of these things may matter for a given application.
LostKobrakai
I’ve already expressed this on github, but I really really like the approach of going from a canonical source like cldr to implementing a money library. I’ve seen money libs include some json file with currencies and their iso codes and number of decimal places, but this only works for as long you won’t need to access this data elsewhere in your application. This is different with ex_money. I can explicitly include ex_cldr in my project and use the underlying data just like ex_money does and there’s no accidental miss-match or the attempt to keep multiple sources in sync.
LostKobrakai
There are few advantages:
- ex_money does support different currencies to be stored with it’s ecto.type.
- ex_money does support stringification based on the user locale a.k.a. “$ 1,000.00” vs “1.000,00 $”
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








