Skip to content

Introspect your database and give that information to your ORM of choice (currently: DBIx::Lite)

License

Notifications You must be signed in to change notification settings

perl-spark/beastform

Repository files navigation

NAME

BeastForm - Introspect a database and dynamically generate models

VERSION

version 0.000001

SYNOPSIS

use BeastForm;
use Mojolicious::Lite;
get "/" => sub {
  $_[0]->stash( drivers => BeastForm::drivers );
  $_[0]->render( template => "form.html.ep" );
};
post "/" => sub {
  my $db = BeastForm::driver( $_[0]->param( 'driver' ) )->connect(
    $_[0]->param( 'db' ), $_[0]->param( 'username' ), $_[0]->param( 'password' )
  )->read_with( 'BeastForm::Reader::SQLT' )
  ->write_with( 'BeastForm::Writer::DBIL::Dynamic' );
  $_[0]->stash( posts => [ $db->table( 'posts' )->all ] );
  $_[0]->render( template => "posts.html.ep" );
};

INTRODUCTION

Because I want to distribute my next application as a single fatpacked script, I can't use the DBIx::Class (and the equally excellent DBIx::Class::Schema::Loader) which leaves me feeling like a sad panda. I know, I'll write some, I thought...

This library provides a means of connecting to a database (via DBIx::Connector), introspecting it and configuring your database wrappers appropriately. We will one day support spitting out module files like DBIx::Class::Schema::Loader

Think of us as the glue code that sorts out the tedious parts of dealing with databases for you so you can get on with building whatever you're working on!

LIBRARY SUPPORT

For input, we currently support: * SQL::Translator (via BeastForm::Reader::SQLT)

For output, we currently support: * DBIx::Lite (via BeastForm::Writer::DBIL)

Database support is anything SQL::Translator supports, which is most things.

MODES OF OPERATION

The primary mode of operation at the minute is 'dynamic'. This attempts to introspect your database and generate a schema for DBIL

We'd like to generate static pm files like DBIx::Class::Schema::Loader one day We'd also like scripts to automate the generation of static files from the shell

CURRENT FEATURES

* Simple Moose-based API * Reasonable support for DBD::Pg * Introspects just about everything SQL::Translator does

FUTURE AIMS

* Better support for other databases (particularly SQLite) * Tests to run on everyone's machine. One day.

DEVELOPMENT AIMS

* Be packable with App::FatPacker (i.e. no XS, try and keep it small) * Favour simplicity and reusing existing cpan * Our (currently) preferred means of keeping an ordered hash is Hash::Ordered * Favour predictability. That means sorting hash keys etc.

GET INVOLVED

It's easy and we're friendly.

1. Fork the repository on github 2. Check out your fork: git clone git@github.com:username/beastform.git && cd beastform 3. Make your changes 4. Add a remote for the upstream repository: git remote add upstream https://github.com/perl-spark 5. Rebase from master: git fetch upstream && git rebase upstream/master 6. File a pull Request!

find_drivers -> Hash[String -> BeastForm::Driver]

Returns a hash of names to Driver objects

AUTHOR

James Laver <james.laver@gmail.com>

CONTRIBUTOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by James Laver on time generously donated by Anomalio.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

About

Introspect your database and give that information to your ORM of choice (currently: DBIx::Lite)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published