Skip to content

Commit

Permalink
document what exactly SQL::Abstract::Pg does
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 26, 2018
1 parent 3de699a commit f70ae20
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Mojo/Pg.pm
Expand Up @@ -559,6 +559,8 @@ Flavio Poletti
Hernan Lopes
Peter Rabbitson
William Lindley
=back
Expand Down
26 changes: 26 additions & 0 deletions lib/SQL/Abstract/Pg.pm
Expand Up @@ -54,6 +54,32 @@ SQL::Abstract::Pg - PostgreSQL Magic
L<SQL::Abstract::Pg> extends L<SQL::Abstract> with a few PostgreSQL features
used by L<Mojo::Pg>.
=head2 ORDER BY
$abstract->select($source, $fields, $where, $order);
$abstract->select($source, $fields, $where, \%options);
Alternatively to the C<$order> argument accepted by L<SQL::Abstract> you can now
also pass a hash reference with various options. This includes C<order_by>,
which takes the same values as the C<$order> argument.
# "select * from some_table order by foo desc"
$abstract->select('some_table', undef, undef, {order_by => {-desc => 'foo'}});
=head2 LIMIT/OFFSET
The C<limit> and C<offset> options can be used to generate C<SELECT> queries
with C<LIMIT> and C<OFFSET> clauses.
# "select * from some_table limit 10"
$abstract->select('some_table', undef, undef, {limit => 10});
# "select * from some_table offset 5"
$abstract->select('some_table', undef, undef, {offset => 5});
# "select * from some_table limit 10 offset 5"
$abstract->select('some_table', undef, undef, {limit => 10, offset => 5});
=head1 METHODS
L<SQL::Abstract::Pg> inherits all methods from L<SQL::Abstract>.
Expand Down

0 comments on commit f70ae20

Please sign in to comment.