| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Rethinkdb; |
|
2
|
15
|
|
|
15
|
|
224332
|
use Rethinkdb::Base -base; |
|
|
15
|
|
|
|
|
29
|
|
|
|
15
|
|
|
|
|
233
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
15
|
|
|
15
|
|
66
|
use Carp 'croak'; |
|
|
15
|
|
|
|
|
17
|
|
|
|
15
|
|
|
|
|
641
|
|
|
5
|
15
|
|
|
15
|
|
55
|
use Scalar::Util 'weaken'; |
|
|
15
|
|
|
|
|
23
|
|
|
|
15
|
|
|
|
|
1213
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
15
|
|
|
15
|
|
5782
|
use Rethinkdb::IO; |
|
|
15
|
|
|
|
|
33
|
|
|
|
15
|
|
|
|
|
140
|
|
|
8
|
15
|
|
|
15
|
|
86
|
use Rethinkdb::Protocol; |
|
|
15
|
|
|
|
|
23
|
|
|
|
15
|
|
|
|
|
84
|
|
|
9
|
15
|
|
|
15
|
|
6106
|
use Rethinkdb::Query::Database; |
|
|
15
|
|
|
|
|
32
|
|
|
|
15
|
|
|
|
|
105
|
|
|
10
|
15
|
|
|
15
|
|
6551
|
use Rethinkdb::Query::Table; |
|
|
15
|
|
|
|
|
30
|
|
|
|
15
|
|
|
|
|
95
|
|
|
11
|
15
|
|
|
15
|
|
76
|
use Rethinkdb::Query; |
|
|
15
|
|
|
|
|
20
|
|
|
|
15
|
|
|
|
|
86
|
|
|
12
|
15
|
|
|
15
|
|
54
|
use Rethinkdb::Util; |
|
|
15
|
|
|
|
|
18
|
|
|
|
15
|
|
|
|
|
47
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# this is set only when connect->repl() |
|
17
|
|
|
|
|
|
|
has 'io'; |
|
18
|
|
|
|
|
|
|
has 'term' => sub { Rethinkdb::Protocol->new->term; }; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub import { |
|
21
|
15
|
|
|
15
|
|
111
|
my $class = shift; |
|
22
|
15
|
|
|
|
|
30
|
my $package = caller; |
|
23
|
|
|
|
|
|
|
|
|
24
|
15
|
|
|
15
|
|
63
|
no strict; |
|
|
15
|
|
|
|
|
20
|
|
|
|
15
|
|
|
|
|
42899
|
|
|
25
|
15
|
|
|
|
|
28
|
*{"$package\::r"} = \&r; |
|
|
15
|
|
|
|
|
83
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
15
|
|
|
|
|
33637
|
return; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub r { |
|
31
|
0
|
|
|
0
|
1
|
|
my $package = caller; |
|
32
|
0
|
|
|
|
|
|
my $self; |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if ($package::_rdb_io) { |
|
35
|
0
|
|
|
|
|
|
$self = __PACKAGE__->new( io => $package::_rdb_io ); |
|
36
|
0
|
|
|
|
|
|
$self->io->_rdb($self); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
else { |
|
39
|
0
|
|
|
|
|
|
$self = __PACKAGE__->new; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $self; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub connect { |
|
46
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
47
|
0
|
|
0
|
|
|
|
my $host = shift || 'localhost'; |
|
48
|
0
|
|
0
|
|
|
|
my $port = shift || 28015; |
|
49
|
0
|
|
0
|
|
|
|
my $db = shift || 'test'; |
|
50
|
0
|
|
0
|
|
|
|
my $auth_key = shift || ''; |
|
51
|
0
|
|
0
|
|
|
|
my $timeout = shift || 20; |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $io = Rethinkdb::IO->new( |
|
54
|
|
|
|
|
|
|
_rdb => $self, |
|
55
|
|
|
|
|
|
|
host => $host, |
|
56
|
|
|
|
|
|
|
port => $port, |
|
57
|
|
|
|
|
|
|
default_db => $db, |
|
58
|
|
|
|
|
|
|
auth_key => $auth_key, |
|
59
|
|
|
|
|
|
|
timeout => $timeout |
|
60
|
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
weaken $io->{_rdb}; |
|
63
|
0
|
|
|
|
|
|
return $io->connect; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# DATABASES |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub db_create { |
|
69
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
70
|
0
|
|
|
|
|
|
my $args = shift; |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
73
|
|
|
|
|
|
|
_rdb => $self, |
|
74
|
|
|
|
|
|
|
_type => $self->term->termType->db_create, |
|
75
|
|
|
|
|
|
|
args => $args, |
|
76
|
|
|
|
|
|
|
); |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
79
|
0
|
|
|
|
|
|
return $q; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub db_drop { |
|
83
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
84
|
0
|
|
|
|
|
|
my $args = shift; |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
87
|
|
|
|
|
|
|
_rdb => $self, |
|
88
|
|
|
|
|
|
|
_type => $self->term->termType->db_drop, |
|
89
|
|
|
|
|
|
|
args => $args |
|
90
|
|
|
|
|
|
|
); |
|
91
|
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
93
|
0
|
|
|
|
|
|
return $q; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub db_list { |
|
97
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
100
|
|
|
|
|
|
|
_rdb => $self, |
|
101
|
|
|
|
|
|
|
_type => $self->term->termType->db_list, |
|
102
|
|
|
|
|
|
|
); |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
105
|
0
|
|
|
|
|
|
return $q; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub db { |
|
109
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
110
|
0
|
|
|
|
|
|
my $name = shift; |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my $db = Rethinkdb::Query::Database->new( |
|
113
|
|
|
|
|
|
|
_rdb => $self, |
|
114
|
|
|
|
|
|
|
name => $name, |
|
115
|
|
|
|
|
|
|
args => $name, |
|
116
|
|
|
|
|
|
|
); |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
weaken $db->{_rdb}; |
|
119
|
0
|
|
|
|
|
|
return $db; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# TABLE |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub table { |
|
125
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
126
|
0
|
|
|
|
|
|
my $name = shift; |
|
127
|
0
|
|
|
|
|
|
my $outdated = shift; |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
my $optargs = {}; |
|
130
|
0
|
0
|
|
|
|
|
if ($outdated) { |
|
131
|
0
|
|
|
|
|
|
$optargs = { use_outdated => 1 }; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my $t = Rethinkdb::Query::Table->new( |
|
135
|
|
|
|
|
|
|
_rdb => $self, |
|
136
|
|
|
|
|
|
|
_type => $self->term->termType->table, |
|
137
|
|
|
|
|
|
|
name => $name, |
|
138
|
|
|
|
|
|
|
args => $name, |
|
139
|
|
|
|
|
|
|
optargs => $optargs, |
|
140
|
|
|
|
|
|
|
); |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
weaken $t->{_rdb}; |
|
143
|
0
|
|
|
|
|
|
return $t; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
# DOCUMENT MANIPULATION |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub row { |
|
149
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
150
|
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
152
|
|
|
|
|
|
|
_rdb => $self, |
|
153
|
|
|
|
|
|
|
_type => $self->term->termType->implicit_var, |
|
154
|
|
|
|
|
|
|
); |
|
155
|
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
157
|
0
|
|
|
|
|
|
return $q; |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub literal { |
|
161
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
162
|
0
|
0
|
|
|
|
|
my $args = ref $_[0] ? $_[0] : {@_}; |
|
163
|
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
165
|
|
|
|
|
|
|
_type => $self->term->termType->literal, |
|
166
|
|
|
|
|
|
|
args => $args, |
|
167
|
|
|
|
|
|
|
); |
|
168
|
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
return $q; |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub object { |
|
173
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
174
|
0
|
0
|
|
|
|
|
my $args = ref $_[0] ? $_[0] : {@_}; |
|
175
|
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
177
|
|
|
|
|
|
|
_type => $self->term->termType->object, |
|
178
|
|
|
|
|
|
|
args => $args, |
|
179
|
|
|
|
|
|
|
); |
|
180
|
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
return $q; |
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# MATH AND LOGIC |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub and { |
|
187
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
188
|
0
|
|
|
|
|
|
my $args = \@_; |
|
189
|
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
191
|
|
|
|
|
|
|
_type => $self->term->termType->and, |
|
192
|
|
|
|
|
|
|
args => $args, |
|
193
|
|
|
|
|
|
|
); |
|
194
|
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
return $q; |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub or { |
|
199
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
200
|
0
|
|
|
|
|
|
my $args = \@_; |
|
201
|
|
|
|
|
|
|
|
|
202
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
203
|
|
|
|
|
|
|
_type => $self->term->termType->or, |
|
204
|
|
|
|
|
|
|
args => $args, |
|
205
|
|
|
|
|
|
|
); |
|
206
|
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
|
return $q; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub random { |
|
211
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
212
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
213
|
0
|
|
|
|
|
|
my $optargs = {}; |
|
214
|
|
|
|
|
|
|
|
|
215
|
0
|
0
|
0
|
|
|
|
if ( ref $args->[2] eq 'HASH' ) { |
|
|
|
0
|
|
|
|
|
|
|
216
|
0
|
|
|
|
|
|
$optargs = $args->[2]; |
|
217
|
|
|
|
|
|
|
} |
|
218
|
0
|
|
|
|
|
|
elsif ( scalar @{$args} > 2 and $args->[2] ) { |
|
219
|
0
|
|
|
|
|
|
$optargs->{float} = r->true; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
# only keep the first two elements |
|
223
|
0
|
|
|
|
|
|
$args = [ splice @{$args}, 0, 2 ]; |
|
|
0
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
226
|
|
|
|
|
|
|
_type => $self->term->termType->random, |
|
227
|
|
|
|
|
|
|
args => $args, |
|
228
|
|
|
|
|
|
|
optargs => $optargs, |
|
229
|
|
|
|
|
|
|
); |
|
230
|
|
|
|
|
|
|
|
|
231
|
0
|
|
|
|
|
|
return $q; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
# DATES AND TIMES |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
sub now { |
|
237
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
238
|
|
|
|
|
|
|
|
|
239
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( _type => $self->term->termType->now ); |
|
240
|
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
return $q; |
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub time { |
|
245
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
246
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
247
|
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
249
|
|
|
|
|
|
|
_type => $self->term->termType->time, |
|
250
|
|
|
|
|
|
|
args => $args |
|
251
|
|
|
|
|
|
|
); |
|
252
|
|
|
|
|
|
|
|
|
253
|
0
|
|
|
|
|
|
return $q; |
|
254
|
|
|
|
|
|
|
} |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
sub epoch_time { |
|
257
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
258
|
0
|
|
|
|
|
|
my $args = shift; |
|
259
|
|
|
|
|
|
|
|
|
260
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
261
|
|
|
|
|
|
|
_type => $self->term->termType->epoch_time, |
|
262
|
|
|
|
|
|
|
args => $args |
|
263
|
|
|
|
|
|
|
); |
|
264
|
|
|
|
|
|
|
|
|
265
|
0
|
|
|
|
|
|
return $q; |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
sub iso8601 { |
|
269
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
270
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
271
|
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
273
|
|
|
|
|
|
|
_type => $self->term->termType->iso8601, |
|
274
|
|
|
|
|
|
|
args => $args |
|
275
|
|
|
|
|
|
|
); |
|
276
|
|
|
|
|
|
|
|
|
277
|
0
|
|
|
|
|
|
return $q; |
|
278
|
|
|
|
|
|
|
} |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
sub monday { |
|
281
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
282
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
283
|
|
|
|
|
|
|
|
|
284
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
285
|
|
|
|
|
|
|
_type => $self->term->termType->monday, |
|
286
|
|
|
|
|
|
|
args => $args |
|
287
|
|
|
|
|
|
|
); |
|
288
|
|
|
|
|
|
|
|
|
289
|
0
|
|
|
|
|
|
return $q; |
|
290
|
|
|
|
|
|
|
} |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
sub tuesday { |
|
293
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
294
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
295
|
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
297
|
|
|
|
|
|
|
_type => $self->term->termType->tuesday, |
|
298
|
|
|
|
|
|
|
args => $args |
|
299
|
|
|
|
|
|
|
); |
|
300
|
|
|
|
|
|
|
|
|
301
|
0
|
|
|
|
|
|
return $q; |
|
302
|
|
|
|
|
|
|
} |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
sub wednesday { |
|
305
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
306
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
307
|
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
309
|
|
|
|
|
|
|
_type => $self->term->termType->wednesday, |
|
310
|
|
|
|
|
|
|
args => $args |
|
311
|
|
|
|
|
|
|
); |
|
312
|
|
|
|
|
|
|
|
|
313
|
0
|
|
|
|
|
|
return $q; |
|
314
|
|
|
|
|
|
|
} |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
sub thursday { |
|
317
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
318
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
319
|
|
|
|
|
|
|
|
|
320
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
321
|
|
|
|
|
|
|
_type => $self->term->termType->thursday, |
|
322
|
|
|
|
|
|
|
args => $args |
|
323
|
|
|
|
|
|
|
); |
|
324
|
|
|
|
|
|
|
|
|
325
|
0
|
|
|
|
|
|
return $q; |
|
326
|
|
|
|
|
|
|
} |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
sub friday { |
|
329
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
330
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
331
|
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
333
|
|
|
|
|
|
|
_type => $self->term->termType->friday, |
|
334
|
|
|
|
|
|
|
args => $args |
|
335
|
|
|
|
|
|
|
); |
|
336
|
|
|
|
|
|
|
|
|
337
|
0
|
|
|
|
|
|
return $q; |
|
338
|
|
|
|
|
|
|
} |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
sub saturday { |
|
341
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
342
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
343
|
|
|
|
|
|
|
|
|
344
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
345
|
|
|
|
|
|
|
_type => $self->term->termType->saturday, |
|
346
|
|
|
|
|
|
|
args => $args |
|
347
|
|
|
|
|
|
|
); |
|
348
|
|
|
|
|
|
|
|
|
349
|
0
|
|
|
|
|
|
return $q; |
|
350
|
|
|
|
|
|
|
} |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
sub sunday { |
|
353
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
354
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
355
|
|
|
|
|
|
|
|
|
356
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
357
|
|
|
|
|
|
|
_type => $self->term->termType->sunday, |
|
358
|
|
|
|
|
|
|
args => $args |
|
359
|
|
|
|
|
|
|
); |
|
360
|
|
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
return $q; |
|
362
|
|
|
|
|
|
|
} |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
sub january { |
|
365
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
366
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
367
|
|
|
|
|
|
|
|
|
368
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
369
|
|
|
|
|
|
|
_type => $self->term->termType->january, |
|
370
|
|
|
|
|
|
|
args => $args |
|
371
|
|
|
|
|
|
|
); |
|
372
|
|
|
|
|
|
|
|
|
373
|
0
|
|
|
|
|
|
return $q; |
|
374
|
|
|
|
|
|
|
} |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub february { |
|
377
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
378
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
379
|
|
|
|
|
|
|
|
|
380
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
381
|
|
|
|
|
|
|
_type => $self->term->termType->february, |
|
382
|
|
|
|
|
|
|
args => $args |
|
383
|
|
|
|
|
|
|
); |
|
384
|
|
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
|
return $q; |
|
386
|
|
|
|
|
|
|
} |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
sub march { |
|
389
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
390
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
391
|
|
|
|
|
|
|
|
|
392
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
393
|
|
|
|
|
|
|
_type => $self->term->termType->march, |
|
394
|
|
|
|
|
|
|
args => $args |
|
395
|
|
|
|
|
|
|
); |
|
396
|
|
|
|
|
|
|
|
|
397
|
0
|
|
|
|
|
|
return $q; |
|
398
|
|
|
|
|
|
|
} |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
sub april { |
|
401
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
402
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
403
|
|
|
|
|
|
|
|
|
404
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
405
|
|
|
|
|
|
|
_type => $self->term->termType->april, |
|
406
|
|
|
|
|
|
|
args => $args |
|
407
|
|
|
|
|
|
|
); |
|
408
|
|
|
|
|
|
|
|
|
409
|
0
|
|
|
|
|
|
return $q; |
|
410
|
|
|
|
|
|
|
} |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
sub may { |
|
413
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
414
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
415
|
|
|
|
|
|
|
|
|
416
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
417
|
|
|
|
|
|
|
_type => $self->term->termType->may, |
|
418
|
|
|
|
|
|
|
args => $args |
|
419
|
|
|
|
|
|
|
); |
|
420
|
|
|
|
|
|
|
|
|
421
|
0
|
|
|
|
|
|
return $q; |
|
422
|
|
|
|
|
|
|
} |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
sub june { |
|
425
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
426
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
427
|
|
|
|
|
|
|
|
|
428
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
429
|
|
|
|
|
|
|
_type => $self->term->termType->june, |
|
430
|
|
|
|
|
|
|
args => $args |
|
431
|
|
|
|
|
|
|
); |
|
432
|
|
|
|
|
|
|
|
|
433
|
0
|
|
|
|
|
|
return $q; |
|
434
|
|
|
|
|
|
|
} |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
sub july { |
|
437
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
438
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
439
|
|
|
|
|
|
|
|
|
440
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
441
|
|
|
|
|
|
|
_type => $self->term->termType->july, |
|
442
|
|
|
|
|
|
|
args => $args |
|
443
|
|
|
|
|
|
|
); |
|
444
|
|
|
|
|
|
|
|
|
445
|
0
|
|
|
|
|
|
return $q; |
|
446
|
|
|
|
|
|
|
} |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
sub august { |
|
449
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
450
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
451
|
|
|
|
|
|
|
|
|
452
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
453
|
|
|
|
|
|
|
_type => $self->term->termType->august, |
|
454
|
|
|
|
|
|
|
args => $args |
|
455
|
|
|
|
|
|
|
); |
|
456
|
|
|
|
|
|
|
|
|
457
|
0
|
|
|
|
|
|
return $q; |
|
458
|
|
|
|
|
|
|
} |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
sub september { |
|
461
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
462
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
463
|
|
|
|
|
|
|
|
|
464
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
465
|
|
|
|
|
|
|
_type => $self->term->termType->september, |
|
466
|
|
|
|
|
|
|
args => $args |
|
467
|
|
|
|
|
|
|
); |
|
468
|
|
|
|
|
|
|
|
|
469
|
0
|
|
|
|
|
|
return $q; |
|
470
|
|
|
|
|
|
|
} |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
sub october { |
|
473
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
474
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
475
|
|
|
|
|
|
|
|
|
476
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
477
|
|
|
|
|
|
|
_type => $self->term->termType->october, |
|
478
|
|
|
|
|
|
|
args => $args |
|
479
|
|
|
|
|
|
|
); |
|
480
|
|
|
|
|
|
|
|
|
481
|
0
|
|
|
|
|
|
return $q; |
|
482
|
|
|
|
|
|
|
} |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
sub november { |
|
485
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
486
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
487
|
|
|
|
|
|
|
|
|
488
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
489
|
|
|
|
|
|
|
_type => $self->term->termType->november, |
|
490
|
|
|
|
|
|
|
args => $args |
|
491
|
|
|
|
|
|
|
); |
|
492
|
|
|
|
|
|
|
|
|
493
|
0
|
|
|
|
|
|
return $q; |
|
494
|
|
|
|
|
|
|
} |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
sub december { |
|
497
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
498
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
499
|
|
|
|
|
|
|
|
|
500
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
501
|
|
|
|
|
|
|
_type => $self->term->termType->december, |
|
502
|
|
|
|
|
|
|
args => $args |
|
503
|
|
|
|
|
|
|
); |
|
504
|
|
|
|
|
|
|
|
|
505
|
0
|
|
|
|
|
|
return $q; |
|
506
|
|
|
|
|
|
|
} |
|
507
|
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
# CONTROL STRUCTURES |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
sub args { |
|
511
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
512
|
0
|
|
|
|
|
|
my $args = [@_]; |
|
513
|
|
|
|
|
|
|
|
|
514
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
515
|
|
|
|
|
|
|
_type => $self->term->termType->args, |
|
516
|
|
|
|
|
|
|
args => $args |
|
517
|
|
|
|
|
|
|
); |
|
518
|
|
|
|
|
|
|
|
|
519
|
0
|
|
|
|
|
|
return $q; |
|
520
|
|
|
|
|
|
|
} |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
# TODO: figure out why the arguments have to be reversed here |
|
523
|
|
|
|
|
|
|
sub do { |
|
524
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
525
|
0
|
|
|
|
|
|
my ( $one, $two ) = @_; |
|
526
|
|
|
|
|
|
|
|
|
527
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
528
|
|
|
|
|
|
|
_rdb => $self, |
|
529
|
|
|
|
|
|
|
_type => $self->term->termType->funcall, |
|
530
|
|
|
|
|
|
|
args => [ $two, $one ], |
|
531
|
|
|
|
|
|
|
); |
|
532
|
|
|
|
|
|
|
|
|
533
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
534
|
0
|
|
|
|
|
|
return $q; |
|
535
|
|
|
|
|
|
|
} |
|
536
|
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
sub branch { |
|
538
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
539
|
0
|
|
|
|
|
|
my ( $predicate, $true, $false ) = @_; |
|
540
|
|
|
|
|
|
|
|
|
541
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
542
|
|
|
|
|
|
|
_rdb => $self, |
|
543
|
|
|
|
|
|
|
_type => $self->term->termType->branch, |
|
544
|
|
|
|
|
|
|
args => [ $predicate, $true, $false ], |
|
545
|
|
|
|
|
|
|
); |
|
546
|
|
|
|
|
|
|
|
|
547
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
548
|
0
|
|
|
|
|
|
return $q; |
|
549
|
|
|
|
|
|
|
} |
|
550
|
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
sub error { |
|
552
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
553
|
0
|
|
|
|
|
|
my ($message) = @_; |
|
554
|
|
|
|
|
|
|
|
|
555
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
556
|
|
|
|
|
|
|
_type => $self->term->termType->error, |
|
557
|
|
|
|
|
|
|
args => $message, |
|
558
|
|
|
|
|
|
|
); |
|
559
|
|
|
|
|
|
|
|
|
560
|
0
|
|
|
|
|
|
return $q; |
|
561
|
|
|
|
|
|
|
} |
|
562
|
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
sub expr { |
|
564
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
565
|
0
|
|
|
|
|
|
my $value = shift; |
|
566
|
|
|
|
|
|
|
|
|
567
|
0
|
|
|
|
|
|
return Rethinkdb::Util->_expr($value); |
|
568
|
|
|
|
|
|
|
} |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
sub js { |
|
571
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
572
|
0
|
|
|
|
|
|
my $args = shift; |
|
573
|
0
|
|
|
|
|
|
my $timeout = shift; |
|
574
|
|
|
|
|
|
|
|
|
575
|
0
|
|
|
|
|
|
my $optargs = {}; |
|
576
|
0
|
0
|
|
|
|
|
if ($timeout) { |
|
577
|
0
|
|
|
|
|
|
$optargs = { timeout => $timeout }; |
|
578
|
|
|
|
|
|
|
} |
|
579
|
|
|
|
|
|
|
|
|
580
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
581
|
|
|
|
|
|
|
_rdb => $self, |
|
582
|
|
|
|
|
|
|
_type => $self->term->termType->javascript, |
|
583
|
|
|
|
|
|
|
args => $args, |
|
584
|
|
|
|
|
|
|
optargs => $optargs, |
|
585
|
|
|
|
|
|
|
); |
|
586
|
|
|
|
|
|
|
|
|
587
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
588
|
0
|
|
|
|
|
|
return $q; |
|
589
|
|
|
|
|
|
|
} |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
sub json { |
|
592
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
593
|
0
|
|
|
|
|
|
my $value = shift; |
|
594
|
|
|
|
|
|
|
|
|
595
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
596
|
|
|
|
|
|
|
_rdb => $self, |
|
597
|
|
|
|
|
|
|
_type => $self->term->termType->json, |
|
598
|
|
|
|
|
|
|
args => $value, |
|
599
|
|
|
|
|
|
|
); |
|
600
|
|
|
|
|
|
|
|
|
601
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
602
|
0
|
|
|
|
|
|
return $q; |
|
603
|
|
|
|
|
|
|
} |
|
604
|
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
sub http { |
|
606
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
607
|
0
|
|
|
|
|
|
my $value = shift; |
|
608
|
0
|
|
|
|
|
|
my $optargs = shift; |
|
609
|
|
|
|
|
|
|
|
|
610
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
611
|
|
|
|
|
|
|
_rdb => $self, |
|
612
|
|
|
|
|
|
|
_type => $self->term->termType->http, |
|
613
|
|
|
|
|
|
|
args => $value, |
|
614
|
|
|
|
|
|
|
optargs => $optargs, |
|
615
|
|
|
|
|
|
|
); |
|
616
|
|
|
|
|
|
|
|
|
617
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
618
|
0
|
|
|
|
|
|
return $q; |
|
619
|
|
|
|
|
|
|
} |
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
sub uuid { |
|
622
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
623
|
0
|
|
|
|
|
|
my $value = shift; |
|
624
|
|
|
|
|
|
|
|
|
625
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
626
|
|
|
|
|
|
|
_rdb => $self, |
|
627
|
|
|
|
|
|
|
_type => $self->term->termType->uuid, |
|
628
|
|
|
|
|
|
|
args => $value, |
|
629
|
|
|
|
|
|
|
); |
|
630
|
|
|
|
|
|
|
|
|
631
|
0
|
|
|
|
|
|
weaken $q->{_rdb}; |
|
632
|
0
|
|
|
|
|
|
return $q; |
|
633
|
|
|
|
|
|
|
} |
|
634
|
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
# GEO |
|
636
|
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
sub circle { |
|
638
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
639
|
0
|
|
|
|
|
|
my $point = shift; |
|
640
|
0
|
|
|
|
|
|
my $radius = shift; |
|
641
|
0
|
|
|
|
|
|
my $optargs = shift; |
|
642
|
|
|
|
|
|
|
|
|
643
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
644
|
|
|
|
|
|
|
_type => $self->term->termType->circle, |
|
645
|
|
|
|
|
|
|
args => [ $point, $radius ], |
|
646
|
|
|
|
|
|
|
optargs => $optargs, |
|
647
|
|
|
|
|
|
|
); |
|
648
|
|
|
|
|
|
|
|
|
649
|
0
|
|
|
|
|
|
return $q; |
|
650
|
|
|
|
|
|
|
} |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
sub distance { |
|
653
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
654
|
0
|
|
|
|
|
|
my $point1 = shift; |
|
655
|
0
|
|
|
|
|
|
my $point2 = shift; |
|
656
|
0
|
|
|
|
|
|
my $optargs = shift; |
|
657
|
|
|
|
|
|
|
|
|
658
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
659
|
|
|
|
|
|
|
_type => $self->term->termType->distance, |
|
660
|
|
|
|
|
|
|
args => [ $point1, $point2 ], |
|
661
|
|
|
|
|
|
|
optargs => $optargs, |
|
662
|
|
|
|
|
|
|
); |
|
663
|
|
|
|
|
|
|
|
|
664
|
0
|
|
|
|
|
|
return $q; |
|
665
|
|
|
|
|
|
|
} |
|
666
|
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
sub geojson { |
|
668
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
669
|
0
|
|
|
|
|
|
my $args = shift; |
|
670
|
|
|
|
|
|
|
|
|
671
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
672
|
|
|
|
|
|
|
_type => $self->term->termType->geojson, |
|
673
|
|
|
|
|
|
|
args => $args, |
|
674
|
|
|
|
|
|
|
); |
|
675
|
|
|
|
|
|
|
|
|
676
|
0
|
|
|
|
|
|
return $q; |
|
677
|
|
|
|
|
|
|
} |
|
678
|
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
sub line { |
|
680
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
681
|
0
|
|
|
|
|
|
my $args = \@_; |
|
682
|
|
|
|
|
|
|
|
|
683
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
684
|
|
|
|
|
|
|
_type => $self->term->termType->line, |
|
685
|
|
|
|
|
|
|
args => $args, |
|
686
|
|
|
|
|
|
|
); |
|
687
|
|
|
|
|
|
|
|
|
688
|
0
|
|
|
|
|
|
return $q; |
|
689
|
|
|
|
|
|
|
} |
|
690
|
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
sub point { |
|
692
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
693
|
0
|
|
|
|
|
|
my $args = \@_; |
|
694
|
|
|
|
|
|
|
|
|
695
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
696
|
|
|
|
|
|
|
_type => $self->term->termType->point, |
|
697
|
|
|
|
|
|
|
args => $args, |
|
698
|
|
|
|
|
|
|
); |
|
699
|
|
|
|
|
|
|
|
|
700
|
0
|
|
|
|
|
|
return $q; |
|
701
|
|
|
|
|
|
|
} |
|
702
|
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
sub polygon { |
|
704
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
705
|
0
|
|
|
|
|
|
my $args = \@_; |
|
706
|
|
|
|
|
|
|
|
|
707
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
708
|
|
|
|
|
|
|
_type => $self->term->termType->polygon, |
|
709
|
|
|
|
|
|
|
args => $args, |
|
710
|
|
|
|
|
|
|
); |
|
711
|
|
|
|
|
|
|
|
|
712
|
0
|
|
|
|
|
|
return $q; |
|
713
|
|
|
|
|
|
|
} |
|
714
|
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
# MISC |
|
717
|
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
sub asc { |
|
719
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
720
|
0
|
|
|
|
|
|
my $name = shift; |
|
721
|
|
|
|
|
|
|
|
|
722
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
723
|
|
|
|
|
|
|
_type => $self->term->termType->asc, |
|
724
|
|
|
|
|
|
|
args => $name, |
|
725
|
|
|
|
|
|
|
); |
|
726
|
|
|
|
|
|
|
|
|
727
|
0
|
|
|
|
|
|
return $q; |
|
728
|
|
|
|
|
|
|
} |
|
729
|
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
sub desc { |
|
731
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
732
|
0
|
|
|
|
|
|
my $name = shift; |
|
733
|
|
|
|
|
|
|
|
|
734
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
735
|
|
|
|
|
|
|
_type => $self->term->termType->desc, |
|
736
|
|
|
|
|
|
|
args => $name, |
|
737
|
|
|
|
|
|
|
); |
|
738
|
|
|
|
|
|
|
|
|
739
|
0
|
|
|
|
|
|
return $q; |
|
740
|
|
|
|
|
|
|
} |
|
741
|
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
sub wait { |
|
743
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
744
|
|
|
|
|
|
|
|
|
745
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
746
|
|
|
|
|
|
|
_rdb => $self, |
|
747
|
|
|
|
|
|
|
_type => $self->term->termType->wait, |
|
748
|
|
|
|
|
|
|
); |
|
749
|
|
|
|
|
|
|
|
|
750
|
0
|
|
|
|
|
|
return $q; |
|
751
|
|
|
|
|
|
|
} |
|
752
|
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
sub minval { |
|
754
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
755
|
|
|
|
|
|
|
|
|
756
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
757
|
|
|
|
|
|
|
_rdb => $self, |
|
758
|
|
|
|
|
|
|
_type => $self->term->termType->minval, |
|
759
|
|
|
|
|
|
|
); |
|
760
|
|
|
|
|
|
|
|
|
761
|
0
|
|
|
|
|
|
return $q; |
|
762
|
|
|
|
|
|
|
} |
|
763
|
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
sub maxval { |
|
765
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
766
|
|
|
|
|
|
|
|
|
767
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
768
|
|
|
|
|
|
|
_rdb => $self, |
|
769
|
|
|
|
|
|
|
_type => $self->term->termType->maxval, |
|
770
|
|
|
|
|
|
|
); |
|
771
|
|
|
|
|
|
|
|
|
772
|
0
|
|
|
|
|
|
return $q; |
|
773
|
|
|
|
|
|
|
} |
|
774
|
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
sub round { |
|
776
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
777
|
0
|
|
|
|
|
|
my $args = shift; |
|
778
|
|
|
|
|
|
|
|
|
779
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
780
|
|
|
|
|
|
|
_rdb => $self, |
|
781
|
|
|
|
|
|
|
_type => $self->term->termType->round, |
|
782
|
|
|
|
|
|
|
args => $args |
|
783
|
|
|
|
|
|
|
); |
|
784
|
|
|
|
|
|
|
|
|
785
|
0
|
|
|
|
|
|
return $q; |
|
786
|
|
|
|
|
|
|
} |
|
787
|
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
sub ceil { |
|
789
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
790
|
0
|
|
|
|
|
|
my $args = shift; |
|
791
|
|
|
|
|
|
|
|
|
792
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
793
|
|
|
|
|
|
|
_rdb => $self, |
|
794
|
|
|
|
|
|
|
_type => $self->term->termType->ceil, |
|
795
|
|
|
|
|
|
|
args => $args |
|
796
|
|
|
|
|
|
|
); |
|
797
|
|
|
|
|
|
|
|
|
798
|
0
|
|
|
|
|
|
return $q; |
|
799
|
|
|
|
|
|
|
} |
|
800
|
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
sub floor { |
|
802
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
803
|
0
|
|
|
|
|
|
my $args = shift; |
|
804
|
|
|
|
|
|
|
|
|
805
|
0
|
|
|
|
|
|
my $q = Rethinkdb::Query->new( |
|
806
|
|
|
|
|
|
|
_rdb => $self, |
|
807
|
|
|
|
|
|
|
_type => $self->term->termType->floor, |
|
808
|
|
|
|
|
|
|
args => $args |
|
809
|
|
|
|
|
|
|
); |
|
810
|
|
|
|
|
|
|
|
|
811
|
0
|
|
|
|
|
|
return $q; |
|
812
|
|
|
|
|
|
|
} |
|
813
|
|
|
|
|
|
|
|
|
814
|
0
|
|
|
0
|
1
|
|
sub true { return Rethinkdb::_True->new; } |
|
815
|
0
|
|
|
0
|
1
|
|
sub false { return Rethinkdb::_False->new; } |
|
816
|
|
|
|
|
|
|
|
|
817
|
|
|
|
|
|
|
package Rethinkdb::_True; |
|
818
|
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
use overload |
|
820
|
0
|
|
|
0
|
|
0
|
'""' => sub {'true'}, |
|
821
|
0
|
|
|
0
|
|
0
|
'bool' => sub {1}, |
|
822
|
0
|
0
|
|
0
|
|
0
|
'eq' => sub { $_[1] eq 'true' ? 1 : 0; }, |
|
823
|
0
|
0
|
|
0
|
|
0
|
'==' => sub { $_[1] == 1 ? 1 : 0; }, |
|
824
|
15
|
|
|
15
|
|
94
|
fallback => 1; |
|
|
15
|
|
|
|
|
20
|
|
|
|
15
|
|
|
|
|
195
|
|
|
825
|
|
|
|
|
|
|
|
|
826
|
0
|
|
|
0
|
|
|
sub new { return bless {}, $_[0] } |
|
827
|
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
package Rethinkdb::_False; |
|
829
|
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
use overload |
|
831
|
0
|
|
|
0
|
|
0
|
'""' => sub {'false'}, |
|
832
|
0
|
|
|
0
|
|
0
|
'bool' => sub {0}, |
|
833
|
0
|
0
|
|
0
|
|
0
|
'eq' => sub { $_[1] eq 'false' ? 1 : 0; }, |
|
834
|
0
|
0
|
|
0
|
|
0
|
'==' => sub { $_[1] == 0 ? 1 : 0; }, |
|
835
|
15
|
|
|
15
|
|
2665
|
fallback => 1; |
|
|
15
|
|
|
|
|
20
|
|
|
|
15
|
|
|
|
|
104
|
|
|
836
|
|
|
|
|
|
|
|
|
837
|
0
|
|
|
0
|
|
|
sub new { return bless {}, $_[0] } |
|
838
|
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
1; |
|
840
|
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
__END__ |