++ed by:
XIAOCANG STAUGAARD AZJADFTRE FUKAI

4 PAUSE users
7 non-PAUSE users.

Yuki Kimoto

NAME

DBIx::Custom::Model - Model (experimental)

SYNOPSIS

use DBIx::Custom::Table;

my $table = DBIx::Custom::Model->new(table => 'books');

ATTRIBUTES

(experimental) columns

    my $columns = $model->columns;
    $model      = $model->columns(['id', 'number']);

dbi

    my $dbi = $model->dbi;
    $model  = $model->dbi($dbi);

DBIx::Custom object.

table

    my $table = $model->table;
    $model    = $model->table('book');

Table name.

primary_key

    my $primary_key = $model->primary_key;
    $model          = $model->primary_key(['id', 'number']);

Foreign key. This is used by update_at(), delete_at(), select_at().

METHODS

DBIx::Custom inherits all methods from Object::Simple, and you can use all methods of the object set to dbi. and implements the following new ones.

delete

    $table->delete(...);
    

Same as delete() of DBIx::Custom except that you don't have to specify table option.

delete_all

    $table->delete_all(...);
    

Same as delete_all() of DBIx::Custom except that you don't have to specify table option.

method

    $table->method(
        count => sub {
            my $self = shift;
        
            return $self->select(column => 'count(*)', @_)
                        ->fetch_first->[0];
        }
    );
    

Add method to a DBIx::Custom::Table object.

insert

    $table->insert(...);
    

Same as insert() of DBIx::Custom except that you don't have to specify table option.

new

    my $table = DBIx::Custom::Table->new;

Create a DBIx::Custom::Table object.

select

    $table->select(...);
    

Same as select() of DBIx::Custom except that you don't have to specify table option.

update

    $table->update(...);
    

Same as update() of DBIx::Custom except that you don't have to specify table option.

update_all

    $table->update_all(param => \%param);
    

Same as update_all() of DBIx::Custom except that you don't have to specify table name.