NAME
Mojo::Pg::Role::PromiseClass - Choose the Mojo::Promise class used by Mojo::Pg objects
VERSION
version 0.002
SYNOPSIS
$pg = Mojo::Pg->new(...)->with_roles('+PromiseClass')
# add promise features you want
$pg->promise_roles('+Repeat');
# and they will show up on every query promise
$pg->db->select_p(...)->repeat(sub{...});
DESCRIPTION
Mojo::Pg::Role::PromiseClass is a role that allows specifying the promise class to be used for the promise-returning methods like (Mojo::Pg::Database's) select_p and insert_p, if you want something different from Mojo::Promise.
Note that if you are also using a custom database_class, you will need to extend it as shown in "SYNOPSIS" in Mojo::Pg::Database::Role::PgPromiseClass.
ATTRIBUTES
Mojo::Pg::Role::PromiseClass inherits the following attributes from Mojo::Base::Role::PromiseClass
promise_class
$pclass = $pg->promise_class;
$pg = $pg->promise_class('Mojo::Promise');
Get or set the preferred promise class. This will be referenced by any db when creating query promises (via select_p, insert_p, ...)
For altering the promise class, you will more likely want to use promise_roles.
METHODS
Mojo::Pg::Role::PromiseClass inherits all methods (promise_roles) from Mojo::Base::Role::PromiseClass and does not define any new ones.
SEE ALSO
Mojo::Pg, Mojo::Promise, Mojolicious, Mojolicious::Guides, https://mojolicious.org.
AUTHOR
Roger Crew <wrog@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2020 by Roger Crew.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)