NAME
Mojo::DB::Role::DBIx::Class - A Mojo role connecting DBIx::Class to Mojo::Pg and Mojo::SQLite
SYNOPSIS
use Mojo::SQLite;
$\ = "\n"; $, = "\t";
my $sql = Mojo::SQLite->new;
my $db = $sql->db;
$db = $db->with_roles('Mojo::DB::Role::DBIx::Class');
my $rs = $db->resultset('SomeTable')->search({ some_field => 'some_value' })
print for $db->dbic->sources
DESCRIPTION
This module adds a dbic method loading a DBIx::Class on top of an existing Mojo::Pg or Mojo::SQLite database
Methods
dbic
-
Connects the database via the schema either with a schema class passed as the parameter:
$db->dbic('My::Schema')
or with a schema class passed as "class" option:
$db->dbic({ class => 'My::Schema' })
or without any schema - in which case DBIx::Class::Schema::Loader gets used
$db->dbic($opts)
All other options get passed on to the class being connected.
Returns the DBIx::Class::Schema so that it can be used like this
print for $db->dbic->sources; my $rs = $db->dbic->resultset('SomeTable')->search({ some_field => 'some_value' })
resultset
-
Shortcut for $db->dbic->resultset
my $rs = $db->resultset('SomeTable')->search({ some_field => 'some_value' })
COPYRIGHT AND LICENSE
This software is copyright (c) 2021 by Simone Cesano.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
SEE ALSO
DBIx::Class, DBIx::Class::Schema::Loader, Mojo::Pg, Mojo::SQLite
AUTHOR
Simone Cesano