DOKK / manpages / debian 12 / libmojo-pg-perl / Mojo::Pg::Transaction.3pm.en
Mojo::Pg::Transaction(3pm) User Contributed Perl Documentation Mojo::Pg::Transaction(3pm)

Mojo::Pg::Transaction - Transaction

  use Mojo::Pg::Transaction;
  my $tx = Mojo::Pg::Transaction->new(db => $db);
  $tx->commit;

Mojo::Pg::Transaction is a scope guard for DBD::Pg transactions used by Mojo::Pg::Database.

Mojo::Pg::Transaction implements the following attributes.

  my $db = $tx->db;
  $tx    = $tx->db(Mojo::Pg::Database->new);

Mojo::Pg::Database object this transaction belongs to. Note that this attribute is weakened.

Mojo::Pg::Transaction inherits all methods from Mojo::Base and implements the following new ones.

  $tx->commit;

Commit transaction.

  my $tx = Mojo::Pg::Transaction->new;
  my $tx = Mojo::Pg::Transaction->new(db => Mojo::Pg::Database->new);
  my $tx = Mojo::Pg::Transaction->new({db => Mojo::Pg::Database->new});

Construct a new Mojo::Pg::Transaction object.

Mojo::Pg, Mojolicious::Guides, <https://mojolicious.org>.

2022-03-19 perl v5.34.0