IO-Async-Pg

 view release on metacpan or  search on metacpan

examples/08-live-dashboard/README.md  view on Meta::CPAN

# 08 - Live Dashboard

Real-time metrics display using pub/sub.

## What it shows

- Metrics recording with instant notifications
- Live dashboard updates via LISTEN/NOTIFY
- Pattern for real-time data streaming

## Architecture

```
┌─────────────────┐         NOTIFY           ┌─────────────────┐
│ Metrics Producer│ ─────────────────────────│    Dashboard    │
│                 │                          │                 │
│ record_metric() │                          │  subscribe()    │
│ INSERT + NOTIFY │                          │  display()      │
└────────┬────────┘                          └────────┬────────┘

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

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

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

            $self->{in_transaction} = 0;
            die $err;
        }

        await $self->query('COMMIT');
        $self->{in_transaction} = 0;
        return $result;
    }
}

# Create a streaming cursor for large result sets
async sub cursor {
    my ($self, $sql, @args) = @_;

    # Parse arguments: can be positional values, hashref for named, or options
    my ($bind, $opts) = $self->_parse_cursor_args(@args);

    # Convert named placeholders if hashref provided
    if (ref $bind eq 'HASH') {
        ($sql, $bind) = convert_placeholders($sql, $bind);
    }



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