Database-Async

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

       ->then(sub { $sth->execute })
       ->then(sub {
        $sth->row_hashrefs
         ->each(sub {
          print $_->{name} . "\n";
         })->completed
       })
     } foreach => [1, 2, 3 ])->get;

METHODS

 transaction

    Resolves to a Future which will yield a Database::Async::Transaction
    instance once ready.

 txn

    Executes code within a transaction. This is meant as a shorter form of
    the common idiom

     $db->transaction
        ->then(sub {
         my ($txn) = @_;
         Future->call($code)
          ->then(sub {
           $txn->commit
          })->on_fail(sub {
           $txn->rollback
          });
        })

    The code must return a Future, and the transaction will only be
    committed if that Future resolves cleanly.

    Returns a Future which resolves once the transaction is committed.

METHODS - Internal

    You're welcome to call these, but they're mostly intended for internal
    usage, and the API may change in future versions.

 uri

    Returns the configured URI for populating database instances.

 pool

    Returns the Database::Async::Pool instance.

 pool_args

    Returns a list of standard pool constructor arguments.

 configure

    Applies configuration, see IO::Async::Notifier for details.

    Supports the following named parameters:

      * uri - the endpoint to use when connecting a new engine instance

      * engine - the parameters to pass when instantiating a new
      Database::Async::Engine

      * pool - parameters for setting up the pool, or a
      Database::Async::Pool instance

      * encoding - default encoding to apply to parameters, queries and
      results, defaults to binary

 ryu

    A Ryu::Async instance, used for requesting sources, sinks and timers.

 new_source

    Instantiates a new Ryu::Source.

 new_sink

    Instantiates a new Ryu::Sink.

 new_future

    Instantiates a new Future.

METHODS - Internal, engine-related

 request_engine

    Attempts to instantiate and connect to a new Database::Async::Engine
    subclass. Returns a Future which should resolve to a new
    Database::Async::Engine instance when ready to use.

 engine_instance

    Loads the appropriate engine class and attaches to the loop.

 engine_ready

    Called by Database::Async::Engine instances when the engine is ready
    for queries.

 queue_query

    Assign the given query to the next available engine instance.

SEE ALSO

    There's a range of options for interacting with databases - at a low
    level:

      * DBIx::Async - runs DBI in subprocesses, very inefficient but tries
      to make all the methods behave a bit like DBI but deferring results
      via Futures.

      * DBI - synchronous database access

      * Mojo::Pg - attaches a DBD::Pg handle to an event loop



( run in 0.848 second using v1.01-cache-2.11-cpan-39bf76dae61 )