NAME

Mojolicious::Plugin::RoutesAuthDBI::POS::Pg - POS for PostgreSQL.

DIAGRAM DB DESIGN

See https://github.com/mche/Mojolicious-Plugin-RoutesAuthDBI/blob/master/Diagram.svg

SYNOPSIS

use Mojolicious::Plugin::RoutesAuthDBI::POS::Pg;

my $sql = Mojolicious::Plugin::RoutesAuthDBI::POS::Pg->instance;
my $sth = $dbh->prepare($sql->{'name foo'});

SEE ALSO

DBIx::POS

SQL definitions

For access methods

  • ---------------------------------------------------------------------

    select *
    from users
    where id = ? or login=?
  • ---------------------------------------------------------------------

    select r.*, ac.controller, ac.namespace, ac.action, ac.callback, ac.id as action_id
    from routes r
      join refs rf on r.id=rf.id1
      join 
      (select a.*, c.controller, c.namespace
        from actions a 
        left join refs r on a.id=r.id2
        left join controllers c on c.id=r.id1
      ) ac on rf.id2=ac.id
    order by r.order_by, r.ts;
  • ---------------------------------------------------------------------

    select g.*
    from
      roles g
      join refs r on g.id=r.id1
    where r.id2=?;
    --and coalesce(g.disable, 0::bit) <> 1::bit
  • ---------------------------------------------------------------------

    select count(*)
    from refs
    where id1 = ? and id2 = ANY(?);
  • ----------------------------------------------------------------------

    select count(c.*)
    from 
      controllers c
      join refs r on c.id=r.id1
      join roles o on r.id2=o.id
    where
      lower(c.controller)=lower(?)
      and c.namespace=?
      and r.id2=any(?)
      and coalesce(o.disable, 0::bit) <> 1::bit
    ;
  • ----------------------------------------------------------------------

    select count(*)
    from roles
    where (id = ? or name = ?)
      and id = any(?)
    ;

For administration actions (controller)

  • ---------------------------------------------------------------------

    insert into users (login, pass) values (?,?)
    returning *;
  • ---------------------------------------------------------------------

    select *
    from roles
    where id=? or lower(name)=?
  • ---------------------------------------------------------------------

    insert into roles (name) values (?)
    returning *;
  • ---------------------------------------------------------------------

    update roles set disable=?::bit where id=? or lower(name)=?
    returning *;
  • ---------------------------------------------------------------------

    select *
    from refs
    where id1=? and id2=?;
  • ---------------------------------------------------------------------

    insert into refs (id1,id2) values (?,?)
    returning *;
  • ---------------------------------------------------------------------

    delete from refs
    where id1=? and id2=?
    returning *;
  • ---------------------------------------------------------------------

    select *
    from controllers
    where
      namespace=?
      and lower(controller)=lower(?)
  • ---------------------------------------------------------------------

    insert into controllers (namespace, controller)
    values (?,?)
    returning *;
  • ---------------------------------------------------------------------

    insert into routes (request, name, auth, descr, disable, order_by)
    values (?,?,?,?,?,?,?,?,?)
    returning *;
  • ---------------------------------------------------------------------

    select u.*
    from
      users u
      join refs r on u.id=r.id2
    where r.id1=?;
  • ---------------------------------------------------------------------

    select t.*
    from
      routes t
      join refs r on t.id=r.id1
    where r.id2=?;
  • ---------------------------------------------------------------------

    select * from controllers;
  • ---------------------------------------------------------------------

    select * from controllers where namespace = ? and controller = ?;
  • ---------------------------------------------------------------------

    insert into controllers (namespace, controller) values (?,?)
    returning *;
  • ---------------------------------------------------------------------

    select a.*, c.namespace, c.controller
    from actions a
      left join refs r on a.id=r.id2
      left join controllers c on c.id=r.id1
  • ---------------------------------------------------------------------

69 POD Errors

The following errors were encountered while parsing the POD:

Around line 36:

Unknown directive: =name

Around line 38:

Unknown directive: =desc

Around line 40:

Unknown directive: =sql

Around line 48:

Unknown directive: =name

Around line 50:

Unknown directive: =desc

Around line 52:

Unknown directive: =sql

Around line 67:

Unknown directive: =name

Around line 69:

Unknown directive: =desc

Around line 71:

Unknown directive: =sql

Around line 82:

Unknown directive: =name

Around line 84:

Unknown directive: =desc

Around line 86:

Unknown directive: =sql

Around line 94:

Unknown directive: =name

Around line 96:

Unknown directive: =desc

Around line 98:

Unknown directive: =sql

Around line 114:

Unknown directive: =name

Around line 116:

Unknown directive: =desc

Around line 118:

Unknown directive: =sql

Around line 134:

Unknown directive: =name

Around line 136:

Unknown directive: =desc

Around line 138:

Unknown directive: =sql

Around line 145:

Unknown directive: =name

Around line 147:

Unknown directive: =desc

Around line 149:

Unknown directive: =sql

Around line 157:

Unknown directive: =name

Around line 159:

Unknown directive: =desc

Around line 161:

Unknown directive: =sql

Around line 168:

Unknown directive: =name

Around line 170:

Unknown directive: =desc

Around line 172:

Unknown directive: =sql

Around line 179:

Unknown directive: =name

Around line 181:

Unknown directive: =desc

Around line 183:

Unknown directive: =sql

Around line 191:

Unknown directive: =name

Around line 193:

Unknown directive: =desc

Around line 195:

Unknown directive: =sql

Around line 203:

Unknown directive: =name

Around line 205:

Unknown directive: =desc

Around line 207:

Unknown directive: =sql

Around line 215:

Unknown directive: =name

Around line 217:

Unknown directive: =desc

Around line 219:

Unknown directive: =sql

Around line 229:

Unknown directive: =name

Around line 231:

Unknown directive: =desc

Around line 233:

Unknown directive: =sql

Around line 241:

Unknown directive: =name

Around line 243:

Unknown directive: =desc

Around line 245:

Unknown directive: =sql

Around line 253:

Unknown directive: =name

Around line 255:

Unknown directive: =desc

Around line 257:

Unknown directive: =sql

Around line 267:

Unknown directive: =name

Around line 269:

Unknown directive: =desc

Around line 271:

Unknown directive: =sql

Around line 282:

Unknown directive: =name

Around line 284:

Unknown directive: =desc

Around line 286:

Unknown directive: =sql

Around line 292:

Unknown directive: =name

Around line 294:

Unknown directive: =desc

Around line 296:

Unknown directive: =sql

Around line 302:

Unknown directive: =name

Around line 304:

Unknown directive: =desc

Around line 306:

Unknown directive: =sql

Around line 314:

Unknown directive: =name

Around line 316:

Unknown directive: =desc

Around line 318:

Unknown directive: =sql

Around line 327:

Unknown directive: =name

Around line 329:

Unknown directive: =desc

Around line 331:

Unknown directive: =sql