line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::CA::API::QueryBuilder; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
7
|
1
|
|
|
1
|
|
168
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
126
|
use JSON; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has field_list => (is => 'ro', required => 1); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has query => (is => 'lazy'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _build_query { |
16
|
0
|
|
|
0
|
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
if (scalar @{$self->field_list} == 0) { |
|
0
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
return encode_json({}); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $query = { |
23
|
|
|
|
|
|
|
'bundles' => {} |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
foreach my $field (@{$self->field_list}) { |
|
0
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $def = sprintf('%s', $field); |
28
|
0
|
|
|
|
|
|
$query->{'bundles'}->{$def} = { |
29
|
|
|
|
|
|
|
'returnAsArray' => JSON::true, |
30
|
|
|
|
|
|
|
'locale' => 'nl_BE' |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return encode_json($query); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
__END__ |