line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rethinkdb::Query::Datum; |
2
|
15
|
|
|
15
|
|
51
|
use Rethinkdb::Base 'Rethinkdb::Query'; |
|
15
|
|
|
|
|
19
|
|
|
15
|
|
|
|
|
64
|
|
3
|
|
|
|
|
|
|
|
4
|
15
|
|
|
15
|
|
67
|
use Carp 'croak'; |
|
15
|
|
|
|
|
22
|
|
|
15
|
|
|
|
|
576
|
|
5
|
15
|
|
|
15
|
|
69
|
use Scalar::Util 'looks_like_number'; |
|
15
|
|
|
|
|
25
|
|
|
15
|
|
|
|
|
548
|
|
6
|
15
|
|
|
15
|
|
61
|
use Rethinkdb::Protocol; |
|
15
|
|
|
|
|
13
|
|
|
15
|
|
|
|
|
73
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'data'; |
9
|
|
|
|
|
|
|
has 'datumType' => sub { Rethinkdb::Protocol->new->datum->datumType; }; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _build { |
12
|
0
|
|
|
0
|
|
|
my $self = shift; |
13
|
0
|
|
|
|
|
|
my $data = $self->data; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $hash = {}; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
0
|
|
|
|
if ( !defined $data ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
$hash = { type => $self->datumType->r_null }; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
elsif ( looks_like_number $data ) { |
21
|
0
|
|
|
|
|
|
$hash = { type => $self->datumType->r_num, r_num => $data }; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
elsif ( !ref $data ) { |
24
|
0
|
|
|
|
|
|
$hash = { type => $self->datumType->r_str, r_str => $data }; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
elsif ( ref $data eq 'Rethinkdb::_True' || ref $data eq 'Rethinkdb::_False' ) |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
|
|
|
$hash = { type => $self->datumType->r_bool, r_bool => $data == 1 }; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
0
|
|
|
|
|
|
croak "Got unknown Datum: $data"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return { type => $self->_termType->datum, datum => $hash, }; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding utf8 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Rethinkdb::Query::Datum - RethinkDB Query Datum |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
L is the smallest building block in the RethinkDB |
50
|
|
|
|
|
|
|
Query Language. A datum can be thought of as a primative. A datum can have the |
51
|
|
|
|
|
|
|
following types: C, C, C, or C. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
L implements the following attributes. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 data |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $datum = r->expr('Lorem Ipsum'); |
60
|
|
|
|
|
|
|
say $datum->data; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The actual datum value of this instance. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 datumType |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $datum = r->expr('Lorem Ipsum'); |
67
|
|
|
|
|
|
|
say $datum->datumType; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The actual RQL (RethinkDB Query Language) datum type of this instance. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SEE ALSO |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
L, L |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |