++ed by:
PINGAN

1 PAUSE user

Adam Hopkins
and 2 contributors

STATUS

Coverage Status

NAME

Mojo::DB::Connector::Role::ResultsRoles - Apply roles to Mojo database results from Mojo::DB::Connector connections

SYNOPSIS

  use Mojo::DB::Connector;

  my $connector = Mojo::DB::Connector->new->with_roles('+ResultsRoles');
  push @{ $connector->results_roles }, 'Mojo::DB::Results::Role::Something';

  # elsewhere...
  my $results = $connector->new_connection('my_database')->db->query(...);
  # $results does Mojo::DB::Results::Role::Something

DESCRIPTION

Mojo::DB::Connector::Role::ResultsRoles allows roles to be applied to the results objects returned by connections acquired from Mojo::DB::Connector.

Mojo::DB::Connector::Role::ResultsRoles is a wrapper around Mojo::DB::Role::ResultsRoles to make sure that connections returned by Mojo::DB::Connector do Mojo::DB::Role::ResultsRoles and use the roles specified in "results_roles".

ATTRIBUTES

results_roles

  my $roles  = $connector->results_roles;
  $connector = $connector->results_roles(\@roles);

Array reference of roles to compose into results objects. This only affects connection objects (Mojo::mysql, Mojo::Pg) created by subsequent calls to "new_connection" in Mojo::DB::Connector.

Note that this is compatible with Mojo::DB::Connector::Role::Cache.

SEE ALSO

LICENSE

This software is copyright (c) 2020 by Adam Hopkins.

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

AUTHOR

Adam Hopkins <srchulo@cpan.org>