cryptoman3/doctrine-dbal-bulk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

cryptoman3/doctrine-dbal-bulk

Composer 安装命令:

composer require cryptoman3/doctrine-dbal-bulk

包简介

Bulk inserts and updates for Doctrine DBAL

README 文档

README

Contributing

This repo is READ ONLY, in order to contribute to Flow PHP project, please open PR against flow monorepo.

Changes merged to monorepo are automatically propagated into sub repositories.

Description

Doctrine Bulk is missing bulk upsert/insert abstraction for Doctrine DBAL.

Installation

composer require flow-php/doctrine-dbal-bulk:1.x@dev

Usage Examples

Insert:

$bulk = Bulk::create();
$bulk->insert(
    $dbalConnection,
    'your-table-name',
    new BulkData([
        ['id' => 1, 'name' => 'Name One', 'description' => 'Description One'],
        ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two'],
        ['id' => 3, 'name' => 'Name Three', 'description' => 'Description Three'],
    ])
);

Update:

$bulk = Bulk::create();
$bulk->update(
    $dbalConnection,
    'your-table-name',
    new BulkData([
        ['id' => 1, 'name' => 'Name One', 'description' => 'Description One'],
        ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two'],
        ['id' => 3, 'name' => 'Name Three', 'description' => 'Description Three'],
    ]),
    [
        'primary_key_columns' => ['id'],
        'update_columns' => ['name']
    ]
);

Supported Dialects

  • PostgreSQL

Adding new Dialects

Dialect is basic abstraction of this library.
The main role of Dialect is to prepare SQL insert/update statement based on BulkData and provided options.

  • $insertOptions
  • $updateOptions

Options are key => value maps without predefined structure that allows to manipulate building SQL statement. Each dialect should define it own structure for options in order to support db engine features, including those that are specific for given engine.

QueryFactory is abstraction for creating queries, there is currently only one implementation, DbalPlatform. QueryFactory insertOptions and updateOptions is combination of all options provided by supported Dialects where each entry must be optional.

example: dialect_option?: string

DbalPlatform is a factory that detects which Dialect should be used for given Doctrine DBAL Platform.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固