A few samples from our code - hope it helps.
:ets.select( ets_name( customer ), [ { { { customer, :_ }, { true, :"$1", :_, :"$2" } },
[ { :andalso,
{ :"==", {:map_get, :a, {:map_get, :job, :"$2"}}, a},
{ :"==", {:map_get, :b, {:map_get, :job, :"$2"}}, b}
} ],
[ [:"$1", :"$2"] ] } ] )
:ets.select_delete( ets_name( customer ), ( for task_id ← task_ids,
do: { { { customer, :_ }, :"$1" }, [ { :"==", {:map_get, :id, :"$1"}, task_id } ], [:true] } ) )
:ets.select( ets_name( customer ),
[ { { { customer, :_ }, { :, :"$1", :, :"$2" } },
[ { :andalso,
{ :">=", :"$1", Util.to_dets( date ) },
{ :"<", :"$1", Util.to_dets( Util.tomorrow ) }
} ],
[ :"$2" ] } ] )
:ets.select( ets_name( customer ),
[ { { { customer, :_ }, :"$1", :"$2", :, : },
[ { :or,
{ :"==", {:map_get, :reattempt, :"$1"}, @auto },
{ :"==", {:map_get, :reattempt, :"$1"}, @manual }
} ],
[ :"$1" ] },
{ { { customer, :_ }, :"$1", @paused, :, : },
[ ],
[ :"$1" ] },
{ { { customer, :_ }, :"$1", @deleted, :, : },
[ ],
[ :"$1" ] },
( if for_seeding,
do: { false, [], [ true ] },
else: { { { customer, :_ }, :"$1", :, :, true },
[ ],
[ :"$1" ] } )
] )






















