eliminate variable name requirement from query()
[scpubgit/DKit.git] / lib / DX / Op / FindAll.pm
1 package DX::Op::FindAll;
2
3 use DX::Op::FromCode;
4 use DX::Op::FindAllCollect;
5 use DX::Var;
6 use DX::OrderedSet;
7 use DX::Op::Return;
8 use Moo;
9
10 with 'DX::Role::Op::FindIsh';
11
12 has coll_name => (is => 'ro', required => 1);
13
14 sub make_result_handler {
15   my ($self, $coll) = @_;
16   my $coll_name = $self->coll_name;
17   DX::Op::FromCode->new(
18     code => sub {
19       my ($self, $state) = @_;
20       $state->assign_vars($coll_name => { bound_value => $coll })
21             ->then($self->next);
22     },
23     next => $self->next
24   );
25 }
26
27 1;