alhost/db') };
get '/' => sub {
my $c = shift;
my $db = $c->mysql->db;
$c->render(json => $db->query('select now() as time')->hash);
};
app->start;
While all I/O operations are p
package Mojo::mysql::Results;
use Mojo::Base -base;
use Mojo::Collection;
use Mojo::JSON 'from_json';
use Mojo::Util 'tablify';
has [qw(db sth)];
sub array { ($_[0]->_expand({list => 0, type => 'ar
my $from_json = __PACKAGE__->can(sprintf '_from_json_mode_%s_%s', $mode, $to->{type});
$from_json->($_, $idx, $names) for @$sql_data;
}
return @$sql_data;
}
sub _from_json_mode_1_array
$names) = @_;
$r->[$_] = from_json $r->[$_] for grep { defined $r->[$_] } @$idx;
}
sub _from_json_mode_1_hash {
my ($r, $idx, $names) = @_;
$r->{$_} = from_json $r->{$_} for grep { defined $r-
:mysql::Database;
use Mojo::Base 'Mojo::EventEmitter';
use Carp;
use Mojo::IOLoop;
use Mojo::JSON 'to_json';
use Mojo::mysql::Results;
use Mojo::mysql::Transaction;
use Mojo::Promise;
use Mojo::Util
i];
my %attrs;
if (ref $param eq 'HASH') {
if (exists $param->{json}) {
$param = to_json $param->{json};
}
elsif (exists $param->{type} && exists $param->{value}) {
t into foo values (?, ?, ?)', @values);
my $results = $db->query('insert into foo values (?)', {json => {bar => 'baz'}});
my $results = $db->query('insert into foo values (?)', {type => SQL_INTEGE
alhost/db') };
get '/' => sub {
my $c = shift;
my $db = $c->mysql->db;
$c->render(json => $db->query('select now() as time')->hash);
};
app->start;
While all I/O operations are p