定制 rajbatch/batchquery 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rajbatch/batchquery

Composer 安装命令:

composer require rajbatch/batchquery

包简介

This will help user to execute the batch query in their laravel projects.

README 文档

README

This will help user to execute the batch(bulk) query in their laravel projects.

Latest Stable Version License Total Downloads Daily Downloads

  1. Easy to Install.
  2. Easy to execute.
  3. Consume very little space, so your project does not get heavy

1. Install

composer require rajbatch/batchquery

Batch(bulk) UPDATE*****

Important parameter needs to be set

 1. $table = "your table name where update";
 2. $index = 'user_id';  // (NOTE: $index field must exist in the $data array. 
                         //  $index performs like WHERE clause to identify
                         //  where needs to update the given value  )
                              
 3. $set   = ['column1','column2];  // (column name to update)
 4. $data  = [
         [
             'user_id'=>1,
             'column1'  =>'column1_value',
             'column2'  =>'column2_value'
         ],
         [
             'user_id'=>2,
             'column1'  =>'column1',
             'column2'  =>'column2_value'
         ],
         [
             'user_id'=>3,
             'column1'  =>'column1',
             'column2'  =>'column2_value'
         ],
     ];

2. Controller

use Rajbatch\Batchquery\Batchquery;

3. In Controller function

      $batch = new Batchquery();
      $table = "your table name where update";
      $index = 'user_id';
      $set   = ['column1'];
      $data  = [
          [
              'user_id'=>1,
              'column1'  =>'column1_value',
              'column2'  =>'column2_value'
          ],
          [
              'user_id'=>2,
              'column1'  =>'column1',
              'column2'  =>'column2_value'
          ],
          [
              'user_id'=>3,
              'column1'  =>'column1',
              'column2'  =>'column2_value'
          ],
      ];
      $response = $batch->batchUpdate($index,$table,$set,$data);

Batch(bulk) INSERT*****

Important parameter needs to be set

 1. $table = "your table name where insert";
 2. $data  = [
         [
             'user_id'=>1,
             'column1'  =>'column1_value',
             'column2'  =>'column2_value'
         ],
         [
             'user_id'=>2,
             'column1'  =>'column1',
             'column2'  =>'column2_value'
         ],
         [
             'user_id'=>3,
             'column1'  =>'column1',
             'column2'  =>'column2_value'
         ],
     ];

2. Controller

use Rajbatch\Batchquery\Batchquery;

3. In Controller function

      $batch = new Batchquery();
      $table = "your table name where insert";
      $data  = [
          [
              'user_id'=>1,
              'column1'  =>'column1_value',
              'column2'  =>'column2_value'
          ],
          [
              'user_id'=>2,
              'column1'  =>'column1',
              'column2'  =>'column2_value'
          ],
          [
              'user_id'=>3,
              'column1'  =>'column1',
              'column2'  =>'column2_value'
          ],
      ];
      $response = $batch->batchInsert($table,$data);

统计信息

  • 总下载量: 57
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固