logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

KiokuX::Model - A simple application specific wrapper for KiokuDB.

Attributes

       directory
           The instantiated directory.

           Created using the other attributes at "BUILD" time.

           This attribute has delegations set up for all the methods of the KiokuDB class.

       dsn e.g. "bdb:dir=root/db". See "connect" in KiokuDB.

       extra_args
           Additional arguments to pass to "connect".

           Can be a hash reference or an array reference.

       typemap
           An optional custom typemap to add. See KiokuDB::Typemap and "typemap" in KiokuDB.

Author

       Yuval Kogman <nothingmuch@woobling.org>

Description

       This base class makes it easy to create KiokuDB database instances in your application. It provides a
       standard way to instantiate and use a KiokuDB object in your apps.

       As your app grows you can subclass it and provide additional convenience methods, without changing the
       structure of the code, but simply swapping your subclass for KiokuX::Model in e.g.
       Catalyst::Model::KiokuDB or whatever you use to glue it in.

Name

       KiokuX::Model - A simple application specific wrapper for KiokuDB.

See Also

       KiokuDB, KiokuDB::Role::API, Catalyst::Model::KiokuDB

Synopsis

               # start with the base class:

               KiokuX::Model->new( dsn => "bdb:dir=/var/myapp/db" );

               # later you can add convenience methods by subclassing:

               package MyApp::DB;
               use Moose;

               extends qw(KiokuX::Model);

               sub add_user {
                       my ( $self, @args ) = @_;

                       my $user = MyApp::User->new(@args);

                       $self->txn_do(sub {
                               $self->insert($user);
                       });

                       return $user;
               }

               # Then just use it like this:

               MyApp::DB->new( dsn => "bdb:dir=/var/myapp/db" );

               # or automatically using e.g. L<Catalyst::Model::KiokuDB>:

               $c->model("kiokudb");

Version Control

       KiokuDB    is    maintained   using   Git.   Information   about   the   repository   is   available   on
       <http://www.iinteractive.com/kiokudb/>

See Also