Transformation: Sort Data
Have a look at the original design in the following figure.
We’re making good progress—we’ve coded all the functions of the top conveyor belt. Our next transformation is to sort the data on its created_at field, with the newest entries first. And this can just use a standard Elixir library function, sort/2. We could create a new module for this, but it would be pretty lonely. For now we’ll put the function in the CLI module and keep an eye out for opportunities to move it out if we add related functions later.
So now our CLI module contains this:
| def process({user, project, _count}) ... |
Get Programming Elixir ≥ 1.6 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.