D
Size: a a a
D
D
ГК
ГК
Enum.all
приходят %{}
, а не %Sort{}
. По структуре они соответствуют %Sort{}
, но являются не страктами, а мапами. Или вы имеете ввиду, что нужно Enum.map
и в нём struct/2
для каждого элемента?D
Enum.all?(sort, &match?(%Sort{}, &1))
ML
AB
DF
DF
DF
D
LL
case blah_blah_blah do
{:ok, %{sort: %Sort{}} = result} -> result
...
end
DF
D
LL
ГК
allAreSort = Enum.all?(
[%{"field" => "s", "direction" => "a"}],
&match?(%Sort{}, &1)
) # false
allAreSort2 = Enum.all?(
[struct(%Sort{}, %{"field" => "s", "direction" => "a"})],
&match?(%Sort{}, &1)
) # true
ГК
D
struct(%Sort{}, %{"field" => "s", "direction" => "a"})
`%Sort{field
: "s", direction
: "a"}
`LL
let it crash
и мониторить логиAB
%{__struct__: StructName, field: ...}