RoutesAuthDBI/Model/Namespaces.pm untested

filter: Statementstmt 0.0% 0 / 14 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 35 CC 6 SCAR 17.3
CC
6
Cov
0%
app_ns
6.0
access
6.0
namespace
6.0
CRAP 5.6
1 package Mojolicious::Plugin::RoutesAuthDBI::Model::Namespaces;
2 #~ use Mojo::Base 'DBIx::Mojo::Model';
3 use Mojo::Base 'Mojolicious::Plugin::RoutesAuthDBI::Model::Base';
4  
5 #~ sub new {
6 #~ state $self = shift->SUPER::new(@_);
7 #~ }
8  
9 sub app_ns {
10 my $self = ref($_[0]) ? shift : shift->new;
11
12 $self->dbh->selectall_arrayref($self->sth('namespaces', where=>"where app_ns=1::bit(1)", order=>"order by ts - (coalesce(interval_ts, 0::int)::varchar || ' second')::interval"), { Slice => {namespace=>1} },);
13 }
14  
15 sub access {
16 my $self = ref($_[0]) ? shift : shift->new;
17
18 $self->dbh->selectrow_array($self->sth('access namespace'), undef, (shift, shift));
19 }
20  
21 sub namespace {
22 my $self = ref($_[0]) ? shift : shift->new;
23
24 $self->dbh->selectrow_hashref($self->sth('namespace'), undef, (@_));
25 }
26  
27 sub new_namespace {
28 my $self = ref($_[0]) ? shift : shift->new;
29
30 $self->dbh->selectrow_hashref($self->sth('new namespace'), undef, (@_));
31 }
32  
33 sub namespaces {
34 my $self = ref($_[0]) ? shift : shift->new;
35 $self->dbh->selectall_arrayref($self->sth('namespaces'), { Slice => {} }, );
36 }
37  
38  
39 1;
40  
41 __DATA__