Skip to content

Commit 6f6e07c

Browse files
committed
增加 composer 支持
1 parent 4f967d5 commit 6f6e07c

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
ThinkPHP 5 的范例,支持任何框架,只需修改 `query` 参数的闭包代码。
88

99
```php
10-
$shardingQuery = new ShardingQuery([
10+
$query = new \ShardingQuery\Query([
1111
'query' => function ($sql) {
1212
return \think\Db::query($sql);
1313
},
@@ -26,11 +26,11 @@ $shardingQuery = new ShardingQuery([
2626
'limit' => 10,
2727
]);
2828
// 查询结果
29-
$result = $shardingQuery->select();
29+
$result = $query->select();
3030
// 总行数,用于分页
31-
$count = $shardingQuery->count();
31+
$count = $query->count();
3232
// 追踪数据,用于调试
33-
$trace = $shardingQuery->trace();
33+
$trace = $query->trace();
3434
```
3535

3636
全部参数:

composer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "mix/sharding-query",
3+
"description": "数据库分表分页查询库 (不依赖框架)",
4+
"type": "library",
5+
"keywords": [
6+
"sharding",
7+
"query"
8+
],
9+
"homepage": "https://github.com/mix-basic/Sharding-Query",
10+
"license": "Apache-2.0",
11+
"authors": [
12+
{
13+
"name": "Jian Liu",
14+
"email": "[email protected]"
15+
}
16+
],
17+
"require": {
18+
"php": ">=5.4.0"
19+
},
20+
"autoload": {
21+
"psr-4": {
22+
"ShardingQuery\\": "src/"
23+
}
24+
}
25+
}

ShardingQuery.php renamed to src/Query.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22

3+
namespace ShardingQuery;
4+
35
/**
46
* 分表数据查询类
7+
* @package ShardingQuery
58
* @author LIUJIAN <[email protected]>
69
*/
7-
class ShardingQuery
10+
class Query
811
{
912

1013
/**

0 commit comments

Comments
 (0)