Ok, that’s a messy question, so let me explain.
I have a list of structs:
[
%Struct{id: 123, foreign_id: 5},
%Struct{id: 456, foreign_id: 6}
]
And a list of maps:
[
%{id: 5},
%{id: 6}
]
What I want to do is pull in the relevant id
from the structs (based on the struct foreign_id
=> map id
). The result I’m looking for:
[
%{id: 5, foreign_id: 123},
%{id: 6, foreign_id: 456}
]
I can stumble my way through this but am wondering what would be an elegant and efficient way to go about it in Elixir? I will be running this on maximum (probably) 500 in each list so doubt I need a stream. I just want to avoid any unnecessary passes.