DBIx-QuickORM
view release on metacpan or search on metacpan
lib/DBIx/QuickORM.pm view on Meta::CPAN
orm myorm2 => sub {
db 'mydb2';
schema 'myschema2';
};
orm my_mix_a => sub {
db 'mydb1';
schema 'myschema2';
};
orm my_mix_b => sub {
db 'mydb2';
schema 'myschema1';
};
Used at the top level. Can contain C<db>, C<schema>, C<handle_class>,
C<autofill>, plus C<alt>, C<plugin>, C<plugins>, C<meta>, and C<build_class>.
=item C<< alt $VARIANT => sub { ... } >>
Can be used to add variations to any builder:
orm my_orm => sub {
db mydb => sub {
# ************************************
alt mysql => sub {
dialect 'MySQL';
};
alt pgsql => sub {
dialect 'PostgreSQL';
};
# ************************************
};
schema my_schema => sub {
table foo => sub {
column x => sub {
identity();
# ************************************
alt mysql => sub {
type \'BIGINT';
};
alt pgsql => sub {
type \'BIGSERIAL';
};
# ************************************
};
}
};
};
Variants can be fetched using the colon C<:> in the name:
my $pg_orm = orm('my_orm:pgsql');
my $mysql_orm = orm('my_orm:mysql');
This works in C<orm()>, C<db()>, C<schema()>, C<table()>, and C<row()> builders. It does
cascade, so if you ask for the C<mysql> variant of an ORM, it will also give you
the C<mysql> variants of the database, schema, tables and rows.
Can be nested under any builder. Can contain whatever the builder it is nested
under can contain.
=item C<< db $NAME >>
=item C<< db $NAME => sub { ... } >>
=item C<< $db = db $NAME >>
=item C<< $db = db $NAME => sub { ... } >>
Used to define a database.
db mydb => sub {
dialect 'MySQL';
host 'mysql.myapp.com';
port 1234;
user $MYSQL_USER;
pass $MYSQL_PASS;
db_name 'myapp_mysql'; # In mysql the db is named myapp_mysql
};
Can also be used to fetch a database by name:
my $db = db('mydb');
Can also be used to tell an ORM which database to use:
orm myorm => sub {
db 'mydb';
...
};
Used at the top level, or nested under C<orm> or C<server>. Can contain
C<driver>, C<dialect>, C<connect>, C<attributes>, C<creds>, C<dsn>, C<host>,
C<port>, C<socket>, C<user>, C<pass>, and C<db_name>.
=item C<dialect '+DBIx::QuickORM::Dialect::PostgreSQL'>
=item C<dialect 'PostgreSQL'>
=item C<dialect 'MySQL'>
=item C<dialect 'MySQL::MariaDB'>
=item C<dialect 'MySQL::Percona'>
=item C<dialect 'MySQL::Community'>
=item C<dialect 'SQLite'>
Specify what dialect of SQL should be used. This is important for reading
schema from an existing database, or writing new schema SQL.
C<DBIx::QuickORM::Dialect::> will be prefixed to the start of any string
provided unless it starts with a plus C<+>, in which case the plus is removed
and the rest of the string is left unmodified.
( run in 0.419 second using v1.01-cache-2.11-cpan-56fb94df46f )