Aniki

 view release on metacpan or  search on metacpan

lib/Aniki/Result.pm  view on Meta::CPAN

package Aniki::Result;
use 5.014002;

use namespace::autoclean;
use Mouse v2.4.5;

has table_name => (
    is       => 'ro',
    required => 1,
);

has suppress_row_objects => (
    is      => 'rw',
    lazy    => 1,
    default => sub { shift->handler->suppress_row_objects },
);

has row_class => (
    is      => 'rw',
    lazy    => 1,
    default => sub {
        my $self = shift;
        $self->handler->guess_row_class($self->table_name);
    },
);

my %handler;

sub BUILD {
    my ($self, $args) = @_;
    $handler{0+$self} = delete $args->{handler};
}

sub handler { $handler{0+shift} }

sub DEMOLISH {
    my $self = shift;
    delete $handler{0+$self};
}

__PACKAGE__->meta->make_immutable();
__END__

=pod

=encoding utf-8

=head1 NAME

Aniki::Result - Result class

=head1 SYNOPSIS

    my $result = $db->select(foo => { bar => 1 });

=head1 DESCRIPTION

This is abstract result class.

Aniki detect the collection class from root result class by table name.
Default root result class is C<MyApp::DB::Collection>.

You can use original result class:



( run in 0.635 second using v1.01-cache-2.11-cpan-5a3173703d6 )