Download the PHP package leslack-hub/laravel-tools without Composer
On this page you can find all versions of the php package leslack-hub/laravel-tools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package laravel-tools
laravel-tools
laravel 7.x 工具类
一、ShardingModel 单字段分表
准备:
继承ShardingModel类 设置SHARDING_COLUMN 分表字段 实现SharingTable 方法。按照规则返回指定表名称
使用:
单字段分表无需修改代码 where中必须含有分表字段,会在where条件中指定的值修改指定的表
二、MultiShardingModel 多字段分表
准备:
需要在单字段分表的基础上实现 按照id分表 为分表的主表 如:按照id 4000w 以下 分了2表 为sharding_order_id_0 sharding_order_id_1 冗余表: 按照user_id 500w用户一张冗余表 实现shardingByUserId 方法,返回指定表名 配置SHARDING_COLUMNS 'user_id' => [ // 分表字段 'condition' => ['id'], // 查询规则 'fill' => ['order_id'], // 需要同步的属性 ], 按照merchant_id 分表同理
用法:
查询主表时 同ShardingModel 一样 也可以使用 shardingWhere 方法指定查询表
查询冗余表 如:用户 123 的所有订单
连表查询参考ShardingModel
三、ArrayService 按照指定key 获取多组的值
使用场景
用法:
All versions of laravel-tools with dependencies
PHP Build Version
Package Version
Requires
laravel/framework Version
7.x
The package leslack-hub/laravel-tools contains the following files
Loading the files please wait ....