skeleton insert code
[dbsrgits/DBIx-Data-Store-old.git] / lib / DBIx / Data / Store / Command / Insert / LastInsertId.pm
CommitLineData
3a2e7c1c 1package DBIx::Data::Store::Command::Insert::LastInsertId;
2
3use Moose;
4use Method::Signatures::Simple;
5
6has 'id_column' => (is => 'ro', required => 1);
7
8has 'insert_call_command' => (is => 'ro', required => 1);
9
10has 'raw_store' => (is => 'ro', required => 1);
11
12method execute {
13 $self->insert_call_command->execute;
14 return { $self->id_column => $self->_get_last_insert_id }
15};
16
17method _get_last_insert_id {
18 # this should probably involve some sort of call to the raw
19 # store to get the command object from it, but meh
20 $self->raw_store->connection->run(sub {
21 shift->last_insert_id((undef) x 4)
22 });
23}
24
25__PACKAGE__->meta->make_immutable;
26
271;