IO-Async-Pg

 view release on metacpan or  search on metacpan

lib/IO/Async/Pg.pm  view on Meta::CPAN

        # We've forked - discard all connections
        @{$self->{idle}} = ();
        @{$self->{active}} = ();
        $self->{pid} = $$;
    }
}

sub _log {
    my ($self, $level, $message) = @_;
    if (my $cb = $self->{on_log}) {
        $cb->($level, $message);
    }
    else {
        warn "IO::Async::Pg [$level]: $message\n";
    }
}

1;

__END__

=head1 NAME

IO::Async::Pg - Async PostgreSQL client for IO::Async

=head1 SYNOPSIS

    use IO::Async::Loop;
    use IO::Async::Pg;

    my $loop = IO::Async::Loop->new;
    my $pg = IO::Async::Pg->new(
        dsn             => 'postgresql://user:pass@host/db',
        min_connections => 2,
        max_connections => 10,
    );
    $loop->add($pg);

    my $conn = await $pg->connection;
    my $result = await $conn->query('SELECT * FROM users WHERE id = $1', $id);
    print $result->first->{name};

=head1 DESCRIPTION

B<WARNING: This is extremely beta software.> The API is subject to change
without notice. The author reserves the right to redesign, rename, or remove
any part of the interface as the module matures. Use in production at your
own peril.

IO::Async::Pg provides an async PostgreSQL client built on IO::Async and
DBD::Pg's async query support. Features include:

=over 4

=item * Connection pooling with automatic management

=item * Named and positional placeholders

=item * Transaction support with savepoints

=item * Cursor-based streaming for large result sets

=item * LISTEN/NOTIFY pub/sub

=back

=head1 AUTHOR

John Napiorkowski E<lt>jjn1056@yahoo.comE<gt>

=head1 LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut



( run in 1.361 second using v1.01-cache-2.11-cpan-140bd7fdf52 )