DBIx-QuickORM

 view release on metacpan or  search on metacpan

lib/DBIx/QuickORM/Manual/QuickStart.pm  view on Meta::CPAN

    # A link to many rows (e.g. all posts by a user):
    my @posts = $user->follow('posts')->all;

    # follow gives you a handle, so you can keep narrowing:
    my @recent = $user->follow('posts')->where({year => 2026})->all;

With an C<autorow> base class these also become named accessors on the row,
matching the link name, so you can write C<< $post->author >> or
C<< $user->posts->all >> directly.

For defining links yourself, naming them, and joining across them, see
L<DBIx::QuickORM::Manual::Relations>.

=head1 RUN A TRANSACTION

Wrap related work in C<txn>. Hand it a callback: if the callback returns
normally the transaction commits; if it throws, the transaction rolls back.

    $con->txn(sub {
        my $txn = shift;

        my $user = $con->insert(users => {name => 'carol'});
        $con->insert(posts => {user_id => $user->field('id'), title => 'Hello'});

        # Returning normally commits. You can also commit or roll back
        # explicitly, which exits the callback immediately:
        #   $txn->commit;
        #   $txn->rollback;
    });

Transactions nest using savepoints, and DBIx::QuickORM can retry a transaction
automatically when the database reports a transient conflict. For all of that,
see L<DBIx::QuickORM::Manual::Transactions>.

=head1 WHERE TO NEXT

You now know enough to be productive. From here:

=over 4

=item L<DBIx::QuickORM::Manual::Concepts>

The key ideas (dialects, schema, affinity) that make everything else easier.

=item L<DBIx::QuickORM::Manual::Schema>

Define your own schema, tables, columns, and custom row classes instead of
introspecting everything.

=item L<DBIx::QuickORM::Manual::Querying>

The full handle interface: where clauses, ordering, limiting, iterators,
create, update, and delete.

=item L<DBIx::QuickORM::Manual::Relations>

Define links (foreign keys), follow them, and join across them.

=item L<DBIx::QuickORM::Manual::Transactions>

Nested transactions, savepoints, callbacks, and automatic retry.

=item L<DBIx::QuickORM::Manual>

The documentation hub, linking every tutorial, guide, and reference.

=back

=head1 SOURCE

The source code repository for DBIx-QuickORM can be found at
L<https://github.com/exodist/DBIx-QuickORM/>.

=head1 MAINTAINERS

=over 4

=item Chad Granum E<lt>exodist@cpan.orgE<gt>

=back

=head1 AUTHORS

=over 4

=item Chad Granum E<lt>exodist@cpan.orgE<gt>

=back

=head1 COPYRIGHT

Copyright Chad Granum E<lt>exodist7@gmail.comE<gt>.

This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

See L<https://dev.perl.org/licenses/>

=cut



( run in 1.056 second using v1.01-cache-2.11-cpan-5b529ec07f3 )