Swoole Coroutine Postgres

Swoole\Coroutine\Postgres

Coroutine version PostgreSQL client.

  • ext-async module is requried.
  • Enable with ./configure --enable-coroutine-postgresql when compiling Swoole.
  • libpq is needed.

Example:

<?php
go(function () {
    $pg = new Swoole\Coroutine\PostgreSQL();
    $conn  = $pg -> connect ("host=127.0.0.1 port=5432 dbname=test user=root password=");
    $result = $pg -> query($conn, 'SELECT * FROM test;');
    $arr = $pg -> fetchAll($result);
    var_dump($arr);
});

The methods are same as PostgreSQL client.