--- /dev/null
+package DBIx::Data::Store::Command::Insert::LastInsertId;
+
+use Moose;
+use Method::Signatures::Simple;
+
+has 'id_column' => (is => 'ro', required => 1);
+
+has 'insert_call_command' => (is => 'ro', required => 1);
+
+has 'raw_store' => (is => 'ro', required => 1);
+
+method execute {
+ $self->insert_call_command->execute;
+ return { $self->id_column => $self->_get_last_insert_id }
+};
+
+method _get_last_insert_id {
+ # this should probably involve some sort of call to the raw
+ # store to get the command object from it, but meh
+ $self->raw_store->connection->run(sub {
+ shift->last_insert_id((undef) x 4)
+ });
+}
+
+__PACKAGE__->meta->make_immutable;
+
+1;