NAME

Mojolicious::Plugin::Tree - Mojolicious Plugin Tree

SYNOPSIS

    my %config = (
	    user=>'root',
	    password=>undef,
	    server=>[
		    {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', type=>'master'},
		    {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', type=>'slave'},
	    ]
    );

    # Mojolicious
    $self->plugin('Mysql'=>\%config);
    $self->plugin('Tree'=>{namespace=>'obj', table=>'tree', length=>10, column=>{id=>'tree_id', name=>'name', path=>'path', level=>'level', parent_id=>'parent_id'}});

    # Mojolicious::Lite
    plugin 'Mysql' => \%config;
    plugin 'Tree'=>{namespace=>'obj', table=>'tree', length=>10, column=>{id=>'tree_id', name=>'name', path=>'path', level=>'level', parent_id=>'parent_id'}};

EXAMPLE

    use Mojo::Util qw(dumper);

    my %config = (
	    user=>'root',
	    password=>undef,
	    server=>[
		    {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', type=>'master'},
		    {dsn=>'database=test;host=localhost;port=3306;mysql_connect_timeout=5;', type=>'slave'},
	    ]
    );

    # Mojolicious
    $self->plugin('Mysql'=>\%config);
    $self->plugin('Tree'=>{namespace=>'obj1', table=>'tree1', length=>10, column=>{id=>'tree_id', name=>'name', path=>'path', level=>'level', parent_id=>'parent_id'}});
    $self->plugin('Tree'=>{namespace=>'obj2', table=>'tree2', length=>10, column=>{id=>'tree_id', name=>'name', path=>'path', level=>'level', parent_id=>'parent_id'}});

    say dumper $self->tree->obj1; # return MojoX::Tree table tree1
    say dumper $self->tree->obj2; # return MojoX::Tree table tree2

HELPERS

tree

$app->tree->obj;

Return MojoX::Tree object.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicio.us.