NAME

Mojolicious::Command::generate::DBIxCustomModel - generate DBIx::Custom model directory structure

VERSION

Version 1.0.2

SYNOPSIS

   Usage: APPLICATION generate DBIxCustomModel [OPTIONS]

     mojo generate DBIxCustomModel -p MyApp -l lib -c generate_model.conf
     mojo generate DBIxCustomModel --package MyApp --lib lib --conf generate_model.conf

   Options:
     -h, --help   Show this summary of available options
     -p, --package the package of generate model on ,defaults "MyApp"
     -l, --lib   lib path ,defaults "lib"
     -c, --config  config file
     
   Config: content of config fiel
     {
       base   => { # base mode config
         sdel  => "is_deleted", # sremove field
         ctime => "create_time",# create time field
         mtime => "update_time",# update time field
         code=> '   # user defiend code
           sub abc{
           }
         '
       },
       models => { # the key is table name
         table_name=>{ # table model config
           sdel  => "is_deleted", # sremove field
           ctime => "create_time",# create time field
           mtime => "update_time",# update time field
           code=> ' # user defiend code
             sub abc{
             }
           '
         }
       }
     }

     

Config

可以在配置文件中进行以下配置:

{
  base   => { # 对 base_package 的配置
    sdel  => "is_deleted", # 软删除字段
    ctime => "create_time",# 创建时间字段
    mtime => "update_time",# 更新时间字段
    code=> '   # 用户自定义扩展代码
      sub abc{
      }
    '
  },
  models => { # 以表名为key,对各个表的配置
    table_name=>{ # 对 base_package 的配置
      sdel  => "is_deleted", # 软删除字段
      ctime => "create_time",# 创建时间字段
      mtime => "update_time",# 更新时间字段
      code=> ' # 用户自定义扩展代码
        sub abc{
        }
      '
    }
  }
}

AUTHOR

WFSO, <461663376@qq.com>

view <%= $table->{Name}.$/ %> view name: <%= $table->{Name}.$/ %>

table <%= $table->{Name}.$/ %> %if($table->{Comment}){ <%= $table->{Comment}.$/ %> %}else{ table name: <%= $table->{Name}.$/ %> %}