Geoffrey
view release on metacpan or search on metacpan
lib/Geoffrey/Action/View.pm view on Meta::CPAN
package Geoffrey::Action::View;
use utf8;
use 5.016;
use strict;
use warnings;
use parent 'Geoffrey::Role::Action';
$Geoffrey::Action::View::VERSION = '0.000206';
sub add {
my ( $self, $params ) = @_;
require Geoffrey::Utils;
my $sql = Geoffrey::Utils::replace_spare( $self->converter->view->add,
[ $params->{name}, $params->{as} ] );
return $self->do($sql);
}
sub alter {
my ( $self, $params ) = @_;
return [ $self->drop( $params->{name} ), $self->add($params) ];
}
sub drop {
my ( $self, $hr_params ) = @_;
require Geoffrey::Utils;
require Ref::Util;
my $s_name = Ref::Util::is_hashref($hr_params) ? delete $hr_params->{name} : $hr_params;
if ( !$s_name ) {
require Geoffrey::Exception::General;
Geoffrey::Exception::General::throw_no_table_name('to drop');
}
return $self->do( Geoffrey::Utils::replace_spare( $self->converter->view->drop, [$s_name] ) );
}
sub list_from_schema {
my ( $self, $schema ) = @_;
my $converter = $self->converter;
return $converter->view_information( $self->do_arrayref( $converter->view->list($schema) ) );
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Geoffrey::Action::View - Handles view actions
=head1 VERSION
Version 0.000206
=head1 DESCRIPTION
=head1 SYNOPSIS
=head1 SUBROUTINES/METHODS
=head2 add
Add view
=head2 alter
Drop view and add new one.
=head2 drop
Drop defined view.
=head2 list_from_schema
Not needed!
=head1 DIAGNOSTICS
=head1 CONFIGURATION AND ENVIRONMENT
=head1 DEPENDENCIES
=head1 INCOMPATIBILITIES
=head1 BUGS AND LIMITATIONS
( run in 1.093 second using v1.01-cache-2.11-cpan-39bf76dae61 )