Mojolicious-Plugin-QuickPg

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/QuickPg.pm  view on Meta::CPAN

  
  # quick insert
  # returns value of primary key (like as last_insert_id on MySQL)
  
  my $id = $c->qinsert('models', { name => 'Moscow',
                                   foto => 'https://www.flickr.com/search/?text=Moscow' } );
  # or you can do like this
  
  my $params = $c->req->json;
  
  # Do not forget to validate $params before it:
  
  my $id = $c->insert('models', $params);
  
  # quick update
  # returns numbers of updated rows
  
  $c->qupdate('models', {id => $id}, { name => 'New York',
                                       foto => 'https://www.flickr.com/search/?text=New%20York'
                                      } );
  



( run in 1.268 second using v1.01-cache-2.11-cpan-39bf76dae61 )