line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Elastic::Model::TypeMap::Common; |
2
|
|
|
|
|
|
|
$Elastic::Model::TypeMap::Common::VERSION = '0.52'; |
3
|
23
|
|
|
23
|
|
17648
|
use strict; |
|
23
|
|
|
|
|
61
|
|
|
23
|
|
|
|
|
652
|
|
4
|
23
|
|
|
23
|
|
129
|
use warnings; |
|
23
|
|
|
|
|
50
|
|
|
23
|
|
|
|
|
709
|
|
5
|
|
|
|
|
|
|
|
6
|
23
|
|
|
23
|
|
132
|
use Elastic::Model::TypeMap::Base qw(:all); |
|
23
|
|
|
|
|
50
|
|
|
23
|
|
|
|
|
184
|
|
7
|
23
|
|
|
23
|
|
153
|
use namespace::autoclean; |
|
23
|
|
|
|
|
55
|
|
|
23
|
|
|
|
|
182
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has_type 'DateTime', |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
deflate_via {'$val->set_time_zone("UTC")->iso8601'}, inflate_via { |
13
|
|
|
|
|
|
|
'do { my %args;' |
14
|
|
|
|
|
|
|
. '@args{ (qw(year month day hour minute second)) } = split /\D/, $val;' |
15
|
|
|
|
|
|
|
. 'DateTime->new(%args);' . '}'; |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
map_via { type => 'date' }; |
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__END__ |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=encoding UTF-8 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Elastic::Model::TypeMap::Common - Type maps for commonly used types |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 VERSION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
version 0.52 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
L<Elastic::Model::TypeMap::Common> provides mapping, inflation and deflation |
40
|
|
|
|
|
|
|
for commonly used types. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 TYPES |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 DateTime |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Attributes with an C<< isa => 'DateTime' >> constraint are deflated to |
47
|
|
|
|
|
|
|
ISO8601 format in UTC, eg C<2012-01-01T01:01:01>, and reinflated via |
48
|
|
|
|
|
|
|
L<DateTime/"new">. They are mapped as C<< { type => 'date' } >>. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Clinton Gormley <drtech@cpan.org> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Clinton Gormley. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
59
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|