Search⌘ K
AI Features

Transformation: Sort Data

Explore how to sort data entries by their creation date in descending order and extract a fixed number of items using built-in Elixir functions. Learn to implement these transformations in a CLI module and write tests to ensure correct behavior, building your skills in data manipulation and project organization.

Sort the data

Let’s 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 ...