lengbin/sub-table
Composer 安装命令:
composer require lengbin/sub-table
包简介
sub table
关键字:
README 文档
README
简单分表
Install
The preferred way to install this extension is through composer.
Either run
composer require lengbin/sub-table
or add
"lengbin/sub-table": "*"
to the require section of your composer.json file.
Use date
$tableName = "t_user_log"; $pdo = new PDO(); $subTable = (new SubTableFactory)->make(SubTableMode::DATE()) $subTable->setKey(date('Y')); // $this->subTable->suffix(); // 根据生成后缀 $this->subTable->setPdo($pdo); // 设置 pdo $this->subTable->createSubTable($tableName); // 生成分表
Use hash
$tableName = "t_user_log"; $pdo = new PDO(); $subTable = (new SubTableFactory)->make(SubTableMode::HASH()) $subTable->setKey(1234); $subTable->setSlices("32"); // 设置 分片 默认 10 // $this->subTable->suffix(); // 根据hash 求余 生成后缀 $this->subTable->setPdo($pdo); // 设置 pdo $this->subTable->createSubTable($tableName); // 生成分表
统计信息
- 总下载量: 172
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-11