Elixir Helpers for Seamless Pipelines

266
clicks
Elixir Helpers for Seamless Pipelines

Source: elixirstreams.com

Type: Video

In Elixir, code is often designed to work seamlessly with pipelines, but sometimes developers encounter breaks that disrupt the flow. This article presents two helpful functions, `then` and `tap`, which can be used to intervene in a pipeline without breaking it. Using a `conn` pipeline as an example, it demonstrates how to inspect a flash assign using `dbg` without stopping the pipeline flow. `then` is a function that lets you perform an operation and continue passing the modified value down the pipeline, while `tap` lets you perform a side-effect without changing the returned value. These functions are beneficial when you need to debug or interact with the data within a pipeline but want to maintain a clean and uninterrupted flow of data.

© HashMerge 2024