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