NAME
Test::DBChanges::ChangeSet - set of changes to DB tables
VERSION
version 1.0.0
SYNOPSIS
my $dbchanges = Test::DBChanges::Pg->new({
dbh => $dbh,
source_names => [qw(things ledger)],
});
# later:
my $changeset = $dbchanges->changeset_for_code(sub { do_something($dbh) });
for my $row ($changeset->changes_for_source('things')->inserted_rows->@*) {
# $row is a hashref with the inserted data
}
DESCRIPTION
Instances of this class are instantiated by a Test::DBChanges::*
class. They contain all the data needed to construct hashrefs or objects for each inserted / updated / deleted row in all tracked tables.
ATTRIBUTES
changed_tables
List of strings, the names of the tables that saw changes.
METHODS
changes_for_source
my $changes = $changeset->changes_for_source('things');
Given a source name (that was in the source_names
attribute of the DBChanges
instance that build this object), returns a Test::DBChanges::TableChangeSet
instance containing the changes for the corresponding table.
If you pass in a wrong (or just not tracked) name, you get undef
.
AUTHOR
Gianni Ceccarelli <gianni.ceccarelli@broadbean.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019 by BroadBean UK, a CareerBuilder Company.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.