>{_rdb};
return $q;
}
sub json {
my $self = shift;
my $value = shift;
my $q = Rethinkdb::Query->new(
_rdb => $self,
_type => $self->term->termType->json,
args => $value,
);
optargs,
);
return $q;
}
sub geojson {
my $self = shift;
my $args = shift;
my $q = Rethinkdb::Query->new(
_type => $self->term->termType->geojson,
args => $args,
);
return $
t error.
=head2 expr
r->expr({a => 'b'})->merge({b => [1,2,3]})->run($conn);
Construct a RQL JSON object from a native object.
=head2 js
r->js("'str1' + 'str2'")->run($conn);
r->table('marv
('test')->table_create('dc_universe')->run;
Create a table. A RethinkDB table is a collection of JSON documents.
If successful, the operation returns an object: C<< {created => 1} >>. If a
table wit
use Rethinkdb::Base -base;
no warnings 'recursion';
use Carp 'croak';
use IO::Socket::INET;
use JSON::PP;
use Rethinkdb::Protocol;
use Rethinkdb::Response;
has host => 'localhost';
has port
lf->auth_key );
$self->_handle->send( pack 'L<',
$self->_protocol->versionDummy->protocol->json );
my $response;
my $char = q{};
do {
$self->_handle->recv( $char, 1 );
$response
return encode_json $data;
}
# temporarily: clean up global optional arguments
sub _simple_encode_hash {
my $data = shift;
my $json = {};
foreach ( keys %{$data} ) {
$json->{$_} = _simple
kage Rethinkdb::Protocol::Protocol;
use Rethinkdb::Base -base;
has 'protobuf' => 0x271ffc41;
has 'json' => 0x7e6970c7;
package Rethinkdb::Protocol::Query;
use Rethinkdb::Base -base;
has 'queryType' =
r_bool' => 2;
has 'r_num' => 3;
has 'r_str' => 4;
has 'r_array' => 5;
has 'r_object' => 6;
has 'r_json' => 7;
package Rethinkdb::Protocol::Term;
use Rethinkdb::Base -base;
has 'termType' => sub { Ret
s 'upcase' => 141;
has 'downcase' => 142;
has 'sample' => 81;
has 'default' => 92;
has 'json' => 98;
has 'to_json_string' => 172;
has 'iso8601' => 99;
has 'to_iso8601' => 100;
has 'epoch_time' => 101;
package Rethinkdb::Response;
use Rethinkdb::Base -base;
use JSON::PP;
use Rethinkdb::Protocol;
has [qw{ type type_description response token error_type backtrace profile }];
sub _init {
my $class
_parent => $self,
_type => $self->_termType->insert,
args => Rethinkdb::Util->_expr_json($args),
optargs => $params,
);
return $q;
}
sub sync {
my $self = shift;
my $q = R
st')->table('dc_universe')->create->run;
Create this table. A RethinkDB table is a collection of JSON documents.
If successful, the operation returns an object: C<< {created => 1} >>. If a
table wit
package Rethinkdb::Util;
use Rethinkdb::Base -base;
use Scalar::Util 'blessed';
use JSON::PP 'encode_json';
use Carp 'croak';
use Rethinkdb::Query::Datum;
use Rethinkdb::Protocol;
my $PROTOCOL = Re
mostly JSON
sub _expr_json {
my $self = shift;
my $value = shift;
if ( blessed($value) && $value->can('_build') ) {
return $value;
}
my $retval;
eval { $retval = encode_json $value
( !$@ && $retval ) {
return Rethinkdb::Query->new(
_type => $PROTOCOL->term->termType->json,
args => $retval
);
}
elsif ( ref $value eq 'ARRAY' ) {
return $self->_make_ar
ill,
);
return $q;
}
sub to_geojson {
my $self = shift;
my $q = Rethinkdb::Query->new(
_parent => $self,
_type => $self->_termType->to_geojson,
);
return $q;
}
sub includes
a single JSON result, or a cursor,
depending on the query.
=head2 update
r->table('posts')->get(1)->update({status => 'published'})->run;
Update JSON documents in a table. Accepts a JSON document
=> 'Aleas jacta est',
status => 'draft'
})->run;
Replace documents in a table. Accepts a JSON document or a ReQL expression, and
replaces the original document with the new one. The new docum