line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
14
|
|
|
14
|
|
117158
|
|
|
14
|
|
|
|
|
42
|
|
|
14
|
|
|
|
|
90
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use parent 'Catmandu::Cmd'; |
7
|
14
|
|
|
14
|
|
103
|
use Catmandu; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
69
|
|
8
|
14
|
|
|
14
|
|
923
|
use Catmandu::Util qw(check_able); |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
64
|
|
9
|
14
|
|
|
14
|
|
2703
|
use namespace::clean; |
|
14
|
|
|
|
|
50
|
|
|
14
|
|
|
|
|
772
|
|
10
|
14
|
|
|
14
|
|
90
|
|
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
71
|
|
11
|
|
|
|
|
|
|
(["cql-query|q=s", ""], ["query=s", ""], ["id=s@", ""],); |
12
|
|
|
|
|
|
|
} |
13
|
1
|
|
|
1
|
1
|
25
|
|
14
|
|
|
|
|
|
|
my ($self, $opts, $args) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my ($from_args, $from_opts) = $self->_parse_options($args); |
17
|
1
|
|
|
1
|
1
|
4
|
|
18
|
|
|
|
|
|
|
my $from_bag = delete $from_opts->{bag}; |
19
|
1
|
|
|
|
|
7
|
my $from = Catmandu->store($from_args->[0], $from_opts)->bag($from_bag); |
20
|
|
|
|
|
|
|
if ($opts->id) { |
21
|
1
|
|
|
|
|
3
|
$from->delete($_) for @{$opts->id}; |
22
|
1
|
|
|
|
|
6
|
} |
23
|
1
|
50
|
33
|
|
|
5
|
elsif ($opts->query // $opts->cql_query) { |
|
|
50
|
|
|
|
|
|
24
|
0
|
|
|
|
|
0
|
check_able($from, 'delete_by_query'); |
|
0
|
|
|
|
|
0
|
|
25
|
|
|
|
|
|
|
$from->delete_by_query( |
26
|
|
|
|
|
|
|
cql_query => $opts->cql_query, |
27
|
0
|
|
|
|
|
0
|
query => $opts->query, |
28
|
0
|
|
|
|
|
0
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
|
|
|
|
|
|
$from->delete_all; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
56
|
$from->commit; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
18
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Catmandu::Cmd::delete - delete items from a store |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 EXAMPLES |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
catmandu delete <STORE> <OPTIONS> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# delete items with matching _id |
52
|
|
|
|
|
|
|
catmandu delete ElasticSearch --index-name items --bag book \ |
53
|
|
|
|
|
|
|
--id 1234 --id 2345 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# delete items matching the query |
56
|
|
|
|
|
|
|
catmandu delete ElasticSearch --index-name items --bag book \ |
57
|
|
|
|
|
|
|
--query 'title:"My Rabbit"' |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# delete all items |
60
|
|
|
|
|
|
|
catmandu delete ElasticSearch --index-name items --bag book |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
catmandu help store ElasticSearch |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |