-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I find often times I'm just folding a map, and most of the code ends up just being getting a key out of the map and then passing it to some validation/execution function
Current behavior
defmodule MyOpus do
use Opus.Pipeline
check :valid_email?
def valid_email?(%{email: email}) when is_binary(email) do
MyValidator.valid_email?(email)
end
endUseful/Dry behavior
defmodule MyOpus do
use Opus.Pipeline
import MyValidator, only: [valid_email?: 1]
# some accessor/getter/lens syntax
check :valid_email?, in: :email
# or
check :valid_email?, get_in: [:email]
# or
check {:email, :valid_email?}
endMetadata
Metadata
Assignees
Labels
No labels