Browse Source

init

master
zhangzhitong 5 years ago
commit
e80f0c9576
  1. 5
      .gitignore
  2. 42
      .travis.yml
  3. 32
      LICENSE.txt
  4. 54
      README.md
  5. 1
      app/.htaccess
  6. 22
      app/AppService.php
  7. 58
      app/ExceptionHandle.php
  8. 8
      app/Request.php
  9. 2
      app/common.php
  10. 92
      app/common/controller/BaseController.php
  11. 55
      app/common/model/BaseModel.php
  12. 22
      app/common/model/ImGroupModel.php
  13. 17
      app/event.php
  14. 19
      app/home/controller/Index.php
  15. 10
      app/middleware.php
  16. 9
      app/provider.php
  17. 9
      app/service.php
  18. 49
      composer.json
  19. 830
      composer.lock
  20. 32
      config/app.php
  21. 29
      config/cache.php
  22. 9
      config/console.php
  23. 18
      config/cookie.php
  24. 62
      config/database.php
  25. 24
      config/filesystem.php
  26. 25
      config/lang.php
  27. 45
      config/log.php
  28. 8
      config/middleware.php
  29. 45
      config/route.php
  30. 19
      config/session.php
  31. 10
      config/trace.php
  32. 25
      config/view.php
  33. 7
      extend/mysql_dll/autoload.php
  34. 445
      extend/mysql_dll/composer/ClassLoader.php
  35. 21
      extend/mysql_dll/composer/LICENSE
  36. 9
      extend/mysql_dll/composer/autoload_classmap.php
  37. 9
      extend/mysql_dll/composer/autoload_namespaces.php
  38. 14
      extend/mysql_dll/composer/autoload_psr4.php
  39. 52
      extend/mysql_dll/composer/autoload_real.php
  40. 54
      extend/mysql_dll/composer/autoload_static.php
  41. 139
      extend/mysql_dll/composer/installed.json
  42. 117
      extend/mysql_dll/easyswoole/ddl/README.md
  43. 28
      extend/mysql_dll/easyswoole/ddl/composer.json
  44. 416
      extend/mysql_dll/easyswoole/ddl/src/Blueprint/Column.php
  45. 132
      extend/mysql_dll/easyswoole/ddl/src/Blueprint/Index.php
  46. 572
      extend/mysql_dll/easyswoole/ddl/src/Blueprint/Table.php
  47. 17
      extend/mysql_dll/easyswoole/ddl/src/Contracts/FilterInterface.php
  48. 33
      extend/mysql_dll/easyswoole/ddl/src/DDLBuilder.php
  49. 236
      extend/mysql_dll/easyswoole/ddl/src/Enum/Character.php
  50. 155
      extend/mysql_dll/easyswoole/ddl/src/Enum/DataType.php
  51. 23
      extend/mysql_dll/easyswoole/ddl/src/Enum/Engine.php
  52. 49
      extend/mysql_dll/easyswoole/ddl/src/Enum/Func.php
  53. 18
      extend/mysql_dll/easyswoole/ddl/src/Enum/Index.php
  54. 21
      extend/mysql_dll/easyswoole/ddl/src/Filter/FilterLimit.php
  55. 21
      extend/mysql_dll/easyswoole/ddl/src/Filter/FilterUnsigned.php
  56. 21
      extend/mysql_dll/easyswoole/ddl/src/Filter/FilterZerofill.php
  57. 41
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterBigint.php
  58. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterBlob.php
  59. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterChar.php
  60. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterDate.php
  61. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterDatetime.php
  62. 27
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterDecimal.php
  63. 29
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterDouble.php
  64. 28
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterFloat.php
  65. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterInt.php
  66. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterLongblob.php
  67. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterLongtext.php
  68. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterMediumblob.php
  69. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterMediumint.php
  70. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterMediumtext.php
  71. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterSmallint.php
  72. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterText.php
  73. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTime.php
  74. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTimestamp.php
  75. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTinyblob.php
  76. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTinyint.php
  77. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTinytext.php
  78. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterVarchar.php
  79. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterYear.php
  80. 21
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterBigint.php
  81. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterBlob.php
  82. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterChar.php
  83. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterDate.php
  84. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterDatetime.php
  85. 21
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterDecimal.php
  86. 21
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterDouble.php
  87. 21
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterFloat.php
  88. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterInt.php
  89. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterLongblob.php
  90. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterLongtext.php
  91. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterMediumblob.php
  92. 21
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterMediumint.php
  93. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterMediumtext.php
  94. 22
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterSmallint.php
  95. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterText.php
  96. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTime.php
  97. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTimestamp.php
  98. 24
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTinyblob.php
  99. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTinyint.php
  100. 23
      extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTinytext.php

5
.gitignore

@ -0,0 +1,5 @@
/.idea
/.vscode
/vendor
*.log
.env

42
.travis.yml

@ -0,0 +1,42 @@
sudo: false
language: php
branches:
only:
- stable
cache:
directories:
- $HOME/.composer/cache
before_install:
- composer self-update
install:
- composer install --no-dev --no-interaction --ignore-platform-reqs
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
- composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
- composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
script:
- php think unit
deploy:
provider: releases
api_key:
secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
file:
- ThinkPHP_Core.zip
- ThinkPHP_Full.zip
skip_cleanup: true
on:
tags: true

32
LICENSE.txt

@ -0,0 +1,32 @@
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
Apache Licence是著名的非盈利开源组织Apache采用的协议。
该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
允许代码修改,再作为开源或商业软件发布。需要满足
的条件:
1. 需要给代码的用户一份Apache Licence ;
2. 如果你修改了代码,需要在被修改的文件中说明;
3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
带有原来代码中的协议,商标,专利声明和其他原来作者规
定需要包含的说明;
4. 如果再发布的产品中包含一个Notice文件,则在Notice文
件中需要带有本协议内容。你可以在Notice中增加自己的
许可,但不可以表现为对Apache Licence构成更改。
具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

54
README.md

@ -0,0 +1,54 @@
ThinkPHP 6.0
===============
> 运行环境要求PHP7.1+。
ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。
## 主要新特性
* 采用`PHP7`强类型(严格模式)
* 支持更多的`PSR`规范
* 原生多应用支持
* 更强大和易用的查询
* 全新的事件系统
* 模型事件和数据库事件统一纳入事件系统
* 模板引擎分离出核心
* 内部功能中间件化
* SESSION/Cookie机制改进
* 对Swoole以及协程支持改进
* 对IDE更加友好
* 统一和精简大量用法
## 安装
~~~
composer create-project topthink/think tp 6.0.*
~~~
如果需要更新框架使用
~~~
composer update topthink/framework
~~~
## 文档
[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
## 参与开发
请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。
## 版权信息
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
本项目包含的第三方源码和二进制文件之版权信息另行标注。
版权所有Copyright © 2006-2020 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
更多细节参阅 [LICENSE.txt](LICENSE.txt)

1
app/.htaccess

@ -0,0 +1 @@
deny from all

22
app/AppService.php

@ -0,0 +1,22 @@
<?php
declare (strict_types = 1);
namespace app;
use think\Service;
/**
* 应用服务类
*/
class AppService extends Service
{
public function register()
{
// 服务注册
}
public function boot()
{
// 服务启动
}
}

58
app/ExceptionHandle.php

@ -0,0 +1,58 @@
<?php
namespace app;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\Handle;
use think\exception\HttpException;
use think\exception\HttpResponseException;
use think\exception\ValidateException;
use think\Response;
use Throwable;
/**
* 应用异常处理类
*/
class ExceptionHandle extends Handle
{
/**
* 不需要记录信息(日志)的异常类列表
* @var array
*/
protected $ignoreReport = [
HttpException::class,
HttpResponseException::class,
ModelNotFoundException::class,
DataNotFoundException::class,
ValidateException::class,
];
/**
* 记录异常信息(包括日志或者其它方式记录)
*
* @access public
* @param Throwable $exception
* @return void
*/
public function report(Throwable $exception): void
{
// 使用内置的方式记录异常日志
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @access public
* @param \think\Request $request
* @param Throwable $e
* @return Response
*/
public function render($request, Throwable $e): Response
{
// 添加自定义异常处理机制
// 其他错误交给系统处理
return parent::render($request, $e);
}
}

8
app/Request.php

@ -0,0 +1,8 @@
<?php
namespace app;
// 应用请求对象类
class Request extends \think\Request
{
}

2
app/common.php

@ -0,0 +1,2 @@
<?php
// 应用公共文件

92
app/common/controller/BaseController.php

@ -0,0 +1,92 @@
<?php
declare (strict_types = 1);
namespace app\common\controller;
use think\App;
use think\Validate;
/**
* 控制器基础类
*/
abstract class BaseController
{
/**
* Request实例
* @var \think\Request
*/
protected $request;
/**
* 应用实例
* @var \think\App
*/
protected $app;
/**
* 是否批量验证
* @var bool
*/
protected $batchValidate = false;
/**
* 控制器中间件
* @var array
*/
protected $middleware = [];
/**
* 构造方法
* @access public
* @param App $app 应用对象
*/
public function __construct(App $app)
{
$this->app = $app;
$this->request = $this->app->request;
// 控制器初始化
$this->initialize();
}
// 初始化
protected function initialize()
{}
/**
* 验证数据
* @access protected
* @param array $data 数据
* @param string|array $validate 验证器名或者验证规则数组
* @param array $message 提示信息
* @param bool $batch 是否批量验证
* @return array|string|true
*/
protected function validate(array $data, $validate, array $message = [], bool $batch = false)
{
if (is_array($validate)) {
$v = new Validate();
$v->rule($validate);
} else {
if (strpos($validate, '.')) {
// 支持场景
[$validate, $scene] = explode('.', $validate);
}
$class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
$v = new $class();
if (!empty($scene)) {
$v->scene($scene);
}
}
$v->message($message);
// 是否批量验证
if ($batch || $this->batchValidate) {
$v->batch(true);
}
return $v->failException(true)->check($data);
}
}

55
app/common/model/BaseModel.php

@ -0,0 +1,55 @@
<?php
namespace app\common\model;
use EasySwoole\DDL\Blueprint\Table;
use EasySwoole\DDL\DDLBuilder;
use EasySwoole\DDL\Enum\Character;
use think\facade\Db;
use think\Model;
abstract class BaseModel extends Model
{
protected static $instance;
protected $comment = "表名备注";
/**
* @return static
*/
public static function Inst()
{
$t = get_called_class();
if (empty(static::$instance[$t])) {
static::$instance[$t] = new static();
}
return static::$instance[$t];
}
/**
* 初始化表
*/
public function initTable()
{
$sql = DDLBuilder::table($this->getTable(), function (Table $table) {
$table->setIfNotExists()->setTableComment($this->comment); //设置表名称
$table->setTableCharset(Character::UTF8MB4_GENERAL_CI);//设置表字符集
$table->colInt('id')->setIsAutoIncrement()->setIsPrimaryKey()->setIsUnsigned()->setColumnComment('主键id');
$table->colDateTime('created_at')->setDefaultValue("CURRENT_TIMESTAMP")->setColumnComment('创建时间');
$table->colDateTime('updated_at')->setDefaultValue("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")->setColumnComment('更新时间');
});
Db::query($sql);
$ori_fields = $this->db()->getTableFields($this->getTable());
$new_fields = $this->generateTableField();
$start = $ori_fields[count($ori_fields) - 3];
foreach ($new_fields as $k => $v) {
if (!in_array($k, $ori_fields)) {
$sql = "ALTER TABLE {$this->getTable()} add $v AFTER $start";
Db::execute($sql);
$start = $k;
}
}
}
abstract protected function generateTableField(): array;
}

22
app/common/model/ImGroupModel.php

@ -0,0 +1,22 @@
<?php
namespace app\common\model;
use EasySwoole\DDL\Blueprint\Table;
use EasySwoole\DDL\DDLBuilder;
class ImGroupModel extends BaseModel
{
protected $name = "im_group_";
protected $comment = "测试表";
protected function generateTableField(): array
{
return DDLBuilder::cols(function (Table $table) {
$table->colVarChar('stu_name', 30)->setColumnComment('学生姓名');
$table->colTinyInt('sex', 1)->setColumnComment('性别:1男,2女')->setDefaultValue(1);
});
}
}

17
app/event.php

@ -0,0 +1,17 @@
<?php
// 事件定义文件
return [
'bind' => [
],
'listen' => [
'AppInit' => [],
'HttpRun' => [],
'HttpEnd' => [],
'LogLevel' => [],
'LogWrite' => [],
],
'subscribe' => [
],
];

19
app/home/controller/Index.php

@ -0,0 +1,19 @@
<?php
namespace app\home\controller;
use app\common\controller\BaseController;
use app\common\model\ImGroupModel;
class Index extends BaseController
{
public function index()
{
$data = ImGroupModel::Inst()->find(1);
return $data;
}
public function hello($name = 'ThinkPHP6')
{
return 'hello,' . $name;
}
}

10
app/middleware.php

@ -0,0 +1,10 @@
<?php
// 全局中间件定义文件
return [
// 全局请求缓存
// \think\middleware\CheckRequestCache::class,
// 多语言加载
// \think\middleware\LoadLangPack::class,
// Session初始化
// \think\middleware\SessionInit::class
];

9
app/provider.php

@ -0,0 +1,9 @@
<?php
use app\ExceptionHandle;
use app\Request;
// 容器Provider定义文件
return [
'think\Request' => Request::class,
'think\exception\Handle' => ExceptionHandle::class,
];

9
app/service.php

@ -0,0 +1,9 @@
<?php
use app\AppService;
// 系统服务定义文件
// 服务在完成全局初始化之后执行
return [
AppService::class,
];

49
composer.json

@ -0,0 +1,49 @@
{
"name": "topthink/think",
"description": "the new thinkphp framework",
"type": "project",
"keywords": [
"framework",
"thinkphp",
"ORM"
],
"homepage": "http://thinkphp.cn/",
"license": "Apache-2.0",
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
},
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"require": {
"php": ">=7.1.0",
"topthink/framework": "^6.0.0",
"topthink/think-orm": "^2.0",
"topthink/think-multi-app": "^1.0"
},
"require-dev": {
"symfony/var-dumper": "^4.2",
"topthink/think-trace":"^1.0"
},
"autoload": {
"psr-4": {
"app\\": "app"
},
"psr-0": {
"": "extend/"
}
},
"config": {
"preferred-install": "dist"
},
"scripts": {
"post-autoload-dump": [
"@php think service:discover",
"@php think vendor:publish"
]
}
}

830
composer.lock

@ -0,0 +1,830 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "9ef3f6f1993fcd90da3b2fda07e08183",
"packages": [
{
"name": "league/flysystem",
"version": "1.0.64",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "d13c43dbd4b791f815215959105a008515d1a2e0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d13c43dbd4b791f815215959105a008515d1a2e0",
"reference": "d13c43dbd4b791f815215959105a008515d1a2e0",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"php": ">=5.5.9"
},
"conflict": {
"league/flysystem-sftp": "<1.0.6"
},
"require-dev": {
"phpspec/phpspec": "^3.4",
"phpunit/phpunit": "^5.7.26"
},
"suggest": {
"ext-fileinfo": "Required for MimeType",
"ext-ftp": "Allows you to use FTP server storage",
"ext-openssl": "Allows you to use FTPS server storage",
"league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2",
"league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3",
"league/flysystem-azure": "Allows you to use Windows Azure Blob storage",
"league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching",
"league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem",
"league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files",
"league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib",
"league/flysystem-webdav": "Allows you to use WebDAV storage",
"league/flysystem-ziparchive": "Allows you to use ZipArchive adapter",
"spatie/flysystem-dropbox": "Allows you to use Dropbox storage",
"srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"League\\Flysystem\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frank de Jonge",
"email": "info@frenky.net"
}
],
"description": "Filesystem abstraction: Many filesystems, one API.",
"keywords": [
"Cloud Files",
"WebDAV",
"abstraction",
"aws",
"cloud",
"copy.com",
"dropbox",
"file systems",
"files",
"filesystem",
"filesystems",
"ftp",
"rackspace",
"remote",
"s3",
"sftp",
"storage"
],
"time": "2020-02-05T18:14:17+00:00"
},
{
"name": "league/flysystem-cached-adapter",
"version": "1.0.9",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem-cached-adapter.git",
"reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f",
"reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f",
"shasum": ""
},
"require": {
"league/flysystem": "~1.0",
"psr/cache": "^1.0.0"
},
"require-dev": {
"mockery/mockery": "~0.9",
"phpspec/phpspec": "^3.4",
"phpunit/phpunit": "^5.7",
"predis/predis": "~1.0",
"tedivm/stash": "~0.12"
},
"suggest": {
"ext-phpredis": "Pure C implemented extension for PHP"
},
"type": "library",
"autoload": {
"psr-4": {
"League\\Flysystem\\Cached\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "frankdejonge",
"email": "info@frenky.net"
}
],
"description": "An adapter decorator to enable meta-data caching.",
"time": "2018-07-09T20:51:04+00:00"
},
{
"name": "opis/closure",
"version": "3.5.1",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "93ebc5712cdad8d5f489b500c59d122df2e53969"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969",
"reference": "93ebc5712cdad8d5f489b500c59d122df2e53969",
"shasum": ""
},
"require": {
"php": "^5.4 || ^7.0"
},
"require-dev": {
"jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.5.x-dev"
}
},
"autoload": {
"psr-4": {
"Opis\\Closure\\": "src/"
},
"files": [
"functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marius Sarca",
"email": "marius.sarca@gmail.com"
},
{
"name": "Sorin Sarca",
"email": "sarca_sorin@hotmail.com"
}
],
"description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
"homepage": "https://opis.io/closure",
"keywords": [
"anonymous functions",
"closure",
"function",
"serializable",
"serialization",
"serialize"
],
"time": "2019-11-29T22:36:02+00:00"
},
{
"name": "psr/cache",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"time": "2016-08-06T20:24:11+00:00"
},
{
"name": "psr/container",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common Container Interface (PHP FIG PSR-11)",
"homepage": "https://github.com/php-fig/container",
"keywords": [
"PSR-11",
"container",
"container-interface",
"container-interop",
"psr"
],
"time": "2017-02-14T16:28:37+00:00"
},
{
"name": "psr/log",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801",
"reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2019-11-01T11:05:21+00:00"
},
{
"name": "psr/simple-cache",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/simple-cache.git",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\SimpleCache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for simple caching",
"keywords": [
"cache",
"caching",
"psr",
"psr-16",
"simple-cache"
],
"time": "2017-10-23T01:57:42+00:00"
},
{
"name": "topthink/framework",
"version": "v6.0.2",
"source": {
"type": "git",
"url": "https://github.com/top-think/framework.git",
"reference": "1444cce94b40a836958380b160a5fb7bfc165daf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/framework/zipball/1444cce94b40a836958380b160a5fb7bfc165daf",
"reference": "1444cce94b40a836958380b160a5fb7bfc165daf",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-mbstring": "*",
"league/flysystem": "^1.0",
"league/flysystem-cached-adapter": "^1.0",
"opis/closure": "^3.1",
"php": ">=7.1.0",
"psr/container": "~1.0",
"psr/log": "~1.0",
"psr/simple-cache": "^1.0",
"topthink/think-helper": "^3.1.1",
"topthink/think-orm": "^2.0"
},
"require-dev": {
"mikey179/vfsstream": "^1.6",
"mockery/mockery": "^1.2",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"autoload": {
"files": [],
"psr-4": {
"think\\": "src/think/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
},
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"description": "The ThinkPHP Framework.",
"homepage": "http://thinkphp.cn/",
"keywords": [
"framework",
"orm",
"thinkphp"
],
"time": "2020-01-13T05:48:05+00:00"
},
{
"name": "topthink/think-helper",
"version": "v3.1.3",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-helper.git",
"reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-helper/zipball/4d85dfd3778623bbb1de3648f1dcd0c82f4439f4",
"reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4",
"shasum": ""
},
"require": {
"php": ">=7.1.0"
},
"type": "library",
"autoload": {
"psr-4": {
"think\\": "src"
},
"files": [
"src/helper.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"description": "The ThinkPHP6 Helper Package",
"time": "2019-09-30T02:36:48+00:00"
},
{
"name": "topthink/think-multi-app",
"version": "v1.0.12",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-multi-app.git",
"reference": "3c1914d2adc08c8753c7f67228885ca47fb9b3bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-multi-app/zipball/3c1914d2adc08c8753c7f67228885ca47fb9b3bf",
"reference": "3c1914d2adc08c8753c7f67228885ca47fb9b3bf",
"shasum": ""
},
"require": {
"php": ">=7.1.0",
"topthink/framework": "^6.0.0"
},
"type": "library",
"extra": {
"think": {
"services": [
"think\\app\\Service"
]
}
},
"autoload": {
"psr-4": {
"think\\app\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "thinkphp6 multi app support",
"time": "2020-03-01T13:29:35+00:00"
},
{
"name": "topthink/think-orm",
"version": "v2.0.31",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-orm.git",
"reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4",
"reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=7.1.0",
"psr/log": "~1.0",
"psr/simple-cache": "^1.0",
"topthink/think-helper": "^3.1"
},
"type": "library",
"autoload": {
"psr-4": {
"think\\": "src"
},
"files": []
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "think orm",
"keywords": [
"database",
"orm"
],
"time": "2020-01-07T10:05:10+00:00"
}
],
"packages-dev": [
{
"name": "symfony/polyfill-mbstring",
"version": "v1.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.14-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2020-01-13T11:15:53+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf",
"reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.14-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"time": "2020-01-13T11:15:53+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v4.4.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "2572839911702b0405479410ea7a1334bfab0b96"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/2572839911702b0405479410ea7a1334bfab0b96",
"reference": "2572839911702b0405479410ea7a1334bfab0b96",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php72": "~1.5"
},
"conflict": {
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
"symfony/console": "<3.4"
},
"require-dev": {
"ext-iconv": "*",
"symfony/console": "^3.4|^4.0|^5.0",
"symfony/process": "^4.4|^5.0",
"twig/twig": "^1.34|^2.4|^3.0"
},
"suggest": {
"ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
"ext-intl": "To show region name in time zone dump",
"symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
},
"bin": [
"Resources/bin/var-dump-server"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.4-dev"
}
},
"autoload": {
"files": [
"Resources/functions/dump.php"
],
"psr-4": {
"Symfony\\Component\\VarDumper\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony mechanism for exploring and dumping PHP variables",
"homepage": "https://symfony.com",
"keywords": [
"debug",
"dump"
],
"time": "2020-02-24T13:10:00+00:00"
},
{
"name": "topthink/think-trace",
"version": "v1.2",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-trace.git",
"reference": "4589d06a07945d57478cc2236f4b23d51ff919cc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-trace/zipball/4589d06a07945d57478cc2236f4b23d51ff919cc",
"reference": "4589d06a07945d57478cc2236f4b23d51ff919cc",
"shasum": ""
},
"require": {
"php": ">=7.1.0",
"topthink/framework": "^6.0.0"
},
"type": "library",
"extra": {
"think": {
"services": [
"think\\trace\\Service"
],
"config": {
"trace": "src/config.php"
}
}
},
"autoload": {
"psr-4": {
"think\\trace\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "thinkphp debug trace",
"time": "2019-10-17T02:14:09+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.1.0"
},
"platform-dev": []
}

32
config/app.php

@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | 应用设置
// +----------------------------------------------------------------------
return [
// 应用地址
'app_host' => env('app.host', ''),
// 应用的命名空间
'app_namespace' => '',
// 是否启用路由
'with_route' => true,
// 默认应用
'default_app' => 'home',
// 默认时区
'default_timezone' => 'Asia/Shanghai',
// 应用映射(自动多应用模式有效)
'app_map' => [],
// 域名绑定(自动多应用模式有效)
'domain_bind' => [],
// 禁止URL访问的应用列表(自动多应用模式有效)
'deny_app_list' => [],
// 异常页面的模板文件
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
// 错误显示信息,非调试模式有效
'error_message' => '页面错误!请稍后再试~',
// 显示错误信息
'show_error_msg' => true,
];

29
config/cache.php

@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | 缓存设置
// +----------------------------------------------------------------------
return [
// 默认缓存驱动
'default' => env('cache.driver', 'file'),
// 缓存连接方式配置
'stores' => [
'file' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => '',
// 缓存前缀
'prefix' => '',
// 缓存有效期 0表示永久缓存
'expire' => 0,
// 缓存标签前缀
'tag_prefix' => 'tag:',
// 序列化机制 例如 ['serialize', 'unserialize']
'serialize' => [],
],
// 更多的缓存连接
],
];

9
config/console.php

@ -0,0 +1,9 @@
<?php
// +----------------------------------------------------------------------
// | 控制台配置
// +----------------------------------------------------------------------
return [
// 指令定义
'commands' => [
],
];

18
config/cookie.php

@ -0,0 +1,18 @@
<?php
// +----------------------------------------------------------------------
// | Cookie设置
// +----------------------------------------------------------------------
return [
// cookie 保存时间
'expire' => 0,
// cookie 保存路径
'path' => '/',
// cookie 有效域名
'domain' => '',
// cookie 启用安全传输
'secure' => false,
// httponly设置
'httponly' => false,
// 是否使用 setcookie
'setcookie' => true,
];

62
config/database.php

@ -0,0 +1,62 @@
<?php
return [
// 默认使用的数据库连接配置
'default' => env('database.driver', 'mysql'),
// 自定义时间查询规则
'time_query_rule' => [],
// 自动写入时间戳字段
// true为自动识别类型 false关闭
// 字符串则明确指定时间字段类型 支持 int timestamp datetime date
'auto_timestamp' => true,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 数据库连接配置信息
'connections' => [
'mysql' => [
// 数据库类型
'type' => env('database.type', 'mysql'),
// 服务器地址
'hostname' => env('database.hostname', '127.0.0.1'),
// 数据库名
'database' => env('database.database', 'test'),
// 用户名
'username' => env('database.username', 'root'),
// 密码
'password' => env('database.password', ''),
// 端口
'hostport' => env('database.hostport', '3306'),
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => env('database.charset', 'utf8'),
// 数据库表前缀
'prefix' => env('database.prefix', 'lst_'),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 是否严格检查字段是否存在
'fields_strict' => true,
// 是否需要断线重连
'break_reconnect' => false,
// 监听SQL
'trigger_sql' => env('app_debug', true),
// 开启字段缓存
'fields_cache' => false,
// 字段缓存路径
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
],
// 更多的数据库配置信息
],
];

24
config/filesystem.php

@ -0,0 +1,24 @@
<?php
return [
// 默认磁盘
'default' => env('filesystem.driver', 'local'),
// 磁盘列表
'disks' => [
'local' => [
'type' => 'local',
'root' => app()->getRuntimePath() . 'storage',
],
'public' => [
// 磁盘类型
'type' => 'local',
// 磁盘路径
'root' => app()->getRootPath() . 'public/storage',
// 磁盘路径对应的外部URL路径
'url' => '/storage',
// 可见性
'visibility' => 'public',
],
// 更多的磁盘配置信息
],
];

25
config/lang.php

@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 多语言设置
// +----------------------------------------------------------------------
return [
// 默认语言
'default_lang' => env('lang.default_lang', 'zh-cn'),
// 允许的语言列表
'allow_lang_list' => [],
// 多语言自动侦测变量名
'detect_var' => 'lang',
// 是否使用Cookie记录
'use_cookie' => true,
// 多语言cookie变量
'cookie_var' => 'think_lang',
// 扩展语言包
'extend_list' => [],
// Accept-Language转义为对应语言包名称
'accept_language' => [
'zh-hans-cn' => 'zh-cn',
],
// 是否支持语言分组
'allow_group' => false,
];

45
config/log.php

@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------------------
return [
// 默认日志记录通道
'default' => env('log.channel', 'file'),
// 日志记录级别
'level' => [],
// 日志类型记录的通道 ['error'=>'email',...]
'type_channel' => [],
// 关闭全局日志写入
'close' => false,
// 全局日志处理 支持闭包
'processor' => null,
// 日志通道列表
'channels' => [
'file' => [
// 日志记录方式
'type' => 'File',
// 日志保存目录
'path' => '',
// 单文件日志写入
'single' => false,
// 独立日志级别
'apart_level' => [],
// 最大日志文件数量
'max_files' => 0,
// 使用JSON格式记录
'json' => false,
// 日志处理
'processor' => null,
// 关闭通道日志写入
'close' => false,
// 日志输出格式化
'format' => '[%s][%s] %s',
// 是否实时写入
'realtime_write' => false,
],
// 其它日志通道配置
],
];

8
config/middleware.php

@ -0,0 +1,8 @@
<?php
// 中间件配置
return [
// 别名或分组
'alias' => [],
// 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
'priority' => [],
];

45
config/route.php

@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | 路由设置
// +----------------------------------------------------------------------
return [
// pathinfo分隔符
'pathinfo_depr' => '/',
// URL伪静态后缀
'url_html_suffix' => 'html',
// URL普通方式参数 用于自动生成
'url_common_param' => true,
// 是否开启路由延迟解析
'url_lazy_route' => false,
// 是否强制使用路由
'url_route_must' => false,
// 合并路由规则
'route_rule_merge' => false,
// 路由是否完全匹配
'route_complete_match' => false,
// 访问控制器层名称
'controller_layer' => 'controller',
// 空控制器名
'empty_controller' => 'Error',
// 是否使用控制器后缀
'controller_suffix' => false,
// 默认的路由变量规则
'default_route_pattern' => '[\w\.]+',
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
'request_cache' => false,
// 请求缓存有效期
'request_cache_expire' => null,
// 全局请求缓存排除规则
'request_cache_except' => [],
// 默认控制器名
'default_controller' => 'Index',
// 默认操作名
'default_action' => 'index',
// 操作方法后缀
'action_suffix' => '',
// 默认JSONP格式返回的处理方法
'default_jsonp_handler' => 'jsonpReturn',
// 默认JSONP处理方法
'var_jsonp_handler' => 'callback',
];

19
config/session.php

@ -0,0 +1,19 @@
<?php
// +----------------------------------------------------------------------
// | 会话设置
// +----------------------------------------------------------------------
return [
// session name
'name' => 'PHPSESSID',
// SESSION_ID的提交变量,解决flash上传跨域
'var_session_id' => '',
// 驱动方式 支持file cache
'type' => 'file',
// 存储连接标识 当type使用cache的时候有效
'store' => null,
// 过期时间
'expire' => 1440,
// 前缀
'prefix' => '',
];

10
config/trace.php

@ -0,0 +1,10 @@
<?php
// +----------------------------------------------------------------------
// | Trace设置 开启调试模式后有效
// +----------------------------------------------------------------------
return [
// 内置Html和Console两种方式 支持扩展
'type' => 'Html',
// 读取的日志通道名
'channel' => '',
];

25
config/view.php

@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 模板设置
// +----------------------------------------------------------------------
return [
// 模板引擎类型使用Think
'type' => 'Think',
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
'auto_rule' => 1,
// 模板目录名
'view_dir_name' => 'view',
// 模板后缀
'view_suffix' => 'html',
// 模板文件名分隔符
'view_depr' => DIRECTORY_SEPARATOR,
// 模板引擎普通标签开始标记
'tpl_begin' => '{',
// 模板引擎普通标签结束标记
'tpl_end' => '}',
// 标签库标签开始标记
'taglib_begin' => '{',
// 标签库标签结束标记
'taglib_end' => '}',
];

7
extend/mysql_dll/autoload.php

@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInite4e760d3dabd5a5ecb618c06e992f333::getLoader();

445
extend/mysql_dll/composer/ClassLoader.php

@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

21
extend/mysql_dll/composer/LICENSE

@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

9
extend/mysql_dll/composer/autoload_classmap.php

@ -0,0 +1,9 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

9
extend/mysql_dll/composer/autoload_namespaces.php

@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

14
extend/mysql_dll/composer/autoload_psr4.php

@ -0,0 +1,14 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'WebSocket\\' => array($vendorDir . '/textalk/websocket/lib'),
'EasySwoole\\Spl\\Test\\' => array($vendorDir . '/easyswoole/spl/test'),
'EasySwoole\\Spl\\' => array($vendorDir . '/easyswoole/spl/src'),
'EasySwoole\\DDL\\Test\\' => array($vendorDir . '/easyswoole/ddl/test'),
'EasySwoole\\DDL\\' => array($vendorDir . '/easyswoole/ddl/src'),
);

52
extend/mysql_dll/composer/autoload_real.php

@ -0,0 +1,52 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInite4e760d3dabd5a5ecb618c06e992f333
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInite4e760d3dabd5a5ecb618c06e992f333', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInite4e760d3dabd5a5ecb618c06e992f333', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInite4e760d3dabd5a5ecb618c06e992f333::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}

54
extend/mysql_dll/composer/autoload_static.php

@ -0,0 +1,54 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInite4e760d3dabd5a5ecb618c06e992f333
{
public static $prefixLengthsPsr4 = array (
'W' =>
array (
'WebSocket\\' => 10,
),
'E' =>
array (
'EasySwoole\\Spl\\Test\\' => 20,
'EasySwoole\\Spl\\' => 15,
'EasySwoole\\DDL\\Test\\' => 20,
'EasySwoole\\DDL\\' => 15,
),
);
public static $prefixDirsPsr4 = array (
'WebSocket\\' =>
array (
0 => __DIR__ . '/..' . '/textalk/websocket/lib',
),
'EasySwoole\\Spl\\Test\\' =>
array (
0 => __DIR__ . '/..' . '/easyswoole/spl/test',
),
'EasySwoole\\Spl\\' =>
array (
0 => __DIR__ . '/..' . '/easyswoole/spl/src',
),
'EasySwoole\\DDL\\Test\\' =>
array (
0 => __DIR__ . '/..' . '/easyswoole/ddl/test',
),
'EasySwoole\\DDL\\' =>
array (
0 => __DIR__ . '/..' . '/easyswoole/ddl/src',
),
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInite4e760d3dabd5a5ecb618c06e992f333::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite4e760d3dabd5a5ecb618c06e992f333::$prefixDirsPsr4;
}, null, ClassLoader::class);
}
}

139
extend/mysql_dll/composer/installed.json

@ -0,0 +1,139 @@
[
{
"name": "easyswoole/ddl",
"version": "1.0.4",
"version_normalized": "1.0.4.0",
"source": {
"type": "git",
"url": "https://github.com/easy-swoole/ddl.git",
"reference": "84dbada2c49115b2bacc6a4cc10b166205fae14a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/easy-swoole/ddl/zipball/84dbada2c49115b2bacc6a4cc10b166205fae14a",
"reference": "84dbada2c49115b2bacc6a4cc10b166205fae14a",
"shasum": ""
},
"require": {
"easyswoole/spl": "^1.2"
},
"time": "2019-11-08T11:12:30+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"EasySwoole\\DDL\\": "src/",
"EasySwoole\\DDL\\Test\\": "test/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "YF",
"email": "291323003@qq.com"
}
],
"description": "An efficient swoole framework",
"homepage": "https://www.easyswoole.com/",
"keywords": [
"async",
"easyswoole",
"framework",
"swoole"
]
},
{
"name": "easyswoole/spl",
"version": "1.3.3",
"version_normalized": "1.3.3.0",
"source": {
"type": "git",
"url": "https://github.com/easy-swoole/spl.git",
"reference": "d0fb72ee0a9febf64a241ebc1cbcaad47d657570"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/easy-swoole/spl/zipball/d0fb72ee0a9febf64a241ebc1cbcaad47d657570",
"reference": "d0fb72ee0a9febf64a241ebc1cbcaad47d657570",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=7.1.0"
},
"require-dev": {
"easyswoole/phpunit": "^1.0"
},
"time": "2019-12-11T03:16:51+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"EasySwoole\\Spl\\": "src/",
"EasySwoole\\Spl\\Test\\": "test/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "YF",
"email": "291323003@qq.com"
}
],
"description": "php stander lib",
"homepage": "https://www.easyswoole.com/",
"keywords": [
"async",
"easyswoole",
"framework",
"swoole"
]
},
{
"name": "textalk/websocket",
"version": "1.2.0",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/Textalk/websocket-php.git",
"reference": "bfa18bb6bf523680c7803f6b04694fbbf2f67bbf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Textalk/websocket-php/zipball/bfa18bb6bf523680c7803f6b04694fbbf2f67bbf",
"reference": "bfa18bb6bf523680c7803f6b04694fbbf2f67bbf",
"shasum": ""
},
"require-dev": {
"cboden/ratchet": "0.3.*",
"phpunit/phpunit": "4.1.*",
"phpunit/phpunit-selenium": "1.3.3",
"satooshi/php-coveralls": "dev-master"
},
"time": "2015-10-09T07:32:42+00:00",
"type": "library",
"installation-source": "source",
"autoload": {
"psr-4": {
"WebSocket\\": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fredrik Liljegren",
"email": "fredrik.liljegren@textalk.se"
}
],
"description": "WebSocket client and server"
}
]

117
extend/mysql_dll/easyswoole/ddl/README.md

@ -0,0 +1,117 @@
# DDL
数据库模式定义语言DDL(Data Definition Language),是用于描述数据库中要存储的现实世界实体的语言。
其实就是我们在创建表的时候用到的一些sql,比如说:CREATE、ALTER、DROP等。
## 测试代码
```php
use EasySwoole\DDL\Blueprint\Table;
use EasySwoole\DDL\DDLBuilder;
use EasySwoole\DDL\Enum\Character;
use EasySwoole\DDL\Enum\Engine;
$sql = DDLBuilder::table('user', function (Table $table) {
$table->setIfNotExists()->setTableComment('用户表'); //设置表名称/
$table->setTableEngine(Engine::MYISAM); //设置表引擎
$table->setTableCharset(Character::UTF8MB4_GENERAL_CI);//设置表字符集
$table->colInt('user_id', 10)->setColumnComment('用户ID')->setIsAutoIncrement()->setIsPrimaryKey(); //创建user_id设置主键并自动增长
$table->colVarChar('username', 30)->setIsNotNull()->setColumnComment('用户名')->setDefaultValue('');
$table->colChar('sex', 1)->setIsNotNull()->setColumnComment('性别:1男,2女')->setDefaultValue(1);
$table->colTinyInt('age')->setIsNotNull()->setColumnComment('年龄')->setIsUnsigned();
$table->colText('intro')->setIsNotNull()->setColumnComment('简介');
$table->colDate('birthday')->setIsNotNull()->setColumnComment('出生日期');
$table->colDecimal('money', 10, 2)->setIsNotNull()->setColumnComment('金额')->setDefaultValue(0);
$table->colInt('created_at', 10)->setIsNotNull()->setColumnComment('创建时间');
$table->colInt('updated_at', 10)->setIsNotNull()->setColumnComment('更新时间');
$table->indexUnique('username_index', 'username')->setIndexComment('用户名唯一索引');//设置索引
$table->indexNormal('username_age_index', ['username', 'age'])->setIndexComment('用户名-年龄');
});
//以下是生成的sql的语句
CREATE TABLE IF NOT EXISTS `user` (
`user_id` int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT COMMENT '用户ID',
`username` varchar(30) NOT NULL DEFAULT '' COMMENT '用户名',
`sex` char(1) NOT NULL DEFAULT 1 COMMENT '性别:1男,2女',
`age` tinyint UNSIGNED NOT NULL COMMENT '年龄',
`intro` text NOT NULL COMMENT '简介',
`birthday` date NOT NULL COMMENT '出生日期',
`money` decimal(10,2) NOT NULL DEFAULT 0 COMMENT '金额',
`created_at` int(10) NOT NULL COMMENT '创建时间',
`updated_at` int(10) NOT NULL COMMENT '更新时间',
UNIQUE INDEX `username_index` (`username`) COMMENT '用户名唯一索引',
INDEX `username_age_index` (`username`,`age`) COMMENT '用户名-年龄'
)
ENGINE = MYISAM DEFAULT COLLATE = 'utf8mb4_general_ci' COMMENT = '用户表';
------------------------------------------------------------------------------------
$stuQql = DDLBuilder::table('student', function (Table $table) {
$table->setIfNotExists()->setTableComment('学生表'); //设置表名称/
$table->setTableCharset(Character::UTF8MB4_GENERAL_CI);//设置表字符集
$table->colInt('stu_id')->setIsAutoIncrement()->setIsPrimaryKey()->setIsUnsigned()->setColumnComment('学生ID'); //创建stu_id设置主键并自动增长
$table->colVarChar('stu_name', 30)->setColumnComment('学生姓名');
$table->colChar('sex', 1)->setColumnComment('性别:1男,2女')->setDefaultValue(1);
$table->colDate('birthday')->setIsNotNull(false)->setColumnComment('出生日期');
$table->colInt('created_at', 10)->setColumnComment('创建时间');
$table->colInt('updated_at', 10)->setColumnComment('更新时间');
$table->indexNormal('stu_name_index', 'stu_name')->setIndexComment('学生姓名--普通索引');//设置索引
});
CREATE TABLE IF NOT EXISTS `student` (
`stu_id` int UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT COMMENT '学生ID',
`stu_name` varchar(30) NOT NULL COMMENT '学生姓名',
`sex` char(1) NOT NULL DEFAULT 1 COMMENT '性别:1男,2女',
`birthday` date NULL DEFAULT NULL COMMENT '出生日期',
`created_at` int(10) NOT NULL COMMENT '创建时间',
`updated_at` int(10) NOT NULL COMMENT '更新时间',
INDEX `stu_name_index` (`stu_name`) COMMENT '学生姓名--普通索引'
)
ENGINE = INNODB DEFAULT COLLATE = 'utf8mb4_general_ci' COMMENT = '学生表';
------------------------------------------------------------------------------------
$courseSql = DDLBuilder::table('course', function (Table $table) {
$table->setIfNotExists()->setTableComment('课程表'); //设置表名称/
$table->setTableCharset(Character::UTF8MB4_GENERAL_CI);//设置表字符集
$table->colInt('id', 3)->setIsPrimaryKey()->setIsAutoIncrement()->setIsUnsigned()->setZeroFill()->setColumnComment('课程id');
$table->colVarChar('course_name', 100)->setColumnComment('课程名称');
$table->colChar('status', 1)->setDefaultValue(1)->setColumnComment('课程状态:1正常,0隐藏');
$table->colInt('created_at', 10)->setColumnComment('创建时间');
$table->colInt('updated_at', 10)->setColumnComment('更新时间');
$table->indexUnique('course_name_index', 'course_name')->setIndexComment('课程名称--唯一索引');//设置索引
});
CREATE TABLE IF NOT EXISTS `course` (
`id` int(3) UNSIGNED ZEROFILL NOT NULL PRIMARY KEY AUTO_INCREMENT COMMENT '课程id',
`course_name` varchar(100) NOT NULL COMMENT '课程名称',
`status` char(1) NOT NULL DEFAULT 1 COMMENT '课程状态:1正常,0隐藏',
`created_at` int(10) NOT NULL COMMENT '创建时间',
`updated_at` int(10) NOT NULL COMMENT '更新时间',
UNIQUE INDEX `course_name_index` (`course_name`) COMMENT '课程名称--唯一索引'
)
ENGINE = INNODB DEFAULT COLLATE = 'utf8mb4_general_ci' COMMENT = '课程表';
------------------------------------------------------------------------------------
$scoreSql = DDLBuilder::table('score', function (Table $table) {
$table->setIfNotExists()->setTableComment('成绩表'); //设置表名称/
$table->setTableCharset(Character::UTF8MB4_GENERAL_CI);//设置表字符集
$table->colInt('id')->setIsUnsigned()->setIsAutoIncrement()->setIsPrimaryKey()->setColumnComment('自增ID');
$table->colInt('stu_id')->setIsUnsigned()->setColumnComment('学生id');
$table->colInt('course_id')->setIsUnsigned()->setZeroFill()->setColumnComment('课程id');
$table->colFloat('score', 3, 1)->setColumnComment('成绩');
$table->colInt('created_at', 10)->setColumnComment('创建时间');
});
CREATE TABLE IF NOT EXISTS `score` (
`id` int UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT COMMENT '自增ID',
`stu_id` int UNSIGNED NOT NULL COMMENT '学生id',
`course_id` int UNSIGNED ZEROFILL NOT NULL COMMENT '课程id',
`score` float(3,1) NOT NULL COMMENT '成绩',
`created_at` int(10) NOT NULL COMMENT '创建时间'
)
ENGINE = INNODB DEFAULT COLLATE = 'utf8mb4_general_ci' COMMENT = '成绩表';
```

28
extend/mysql_dll/easyswoole/ddl/composer.json

@ -0,0 +1,28 @@
{
"name": "easyswoole/ddl",
"type": "library",
"description": "An efficient swoole framework",
"keywords": [
"swoole",
"framework",
"async",
"easyswoole"
],
"homepage": "https://www.easyswoole.com/",
"license": "Apache-2.0",
"authors": [
{
"name": "YF",
"email": "291323003@qq.com"
}
],
"autoload": {
"psr-4": {
"EasySwoole\\DDL\\": "src/",
"EasySwoole\\DDL\\Test\\":"test/"
}
},
"require": {
"easyswoole/spl": "^1.2"
}
}

416
extend/mysql_dll/easyswoole/ddl/src/Blueprint/Column.php

@ -0,0 +1,416 @@
<?php
namespace EasySwoole\DDL\Blueprint;
use EasySwoole\DDL\Enum\DataType;
use EasySwoole\DDL\Filter\FilterLimit;
use EasySwoole\DDL\Filter\FilterUnsigned;
use EasySwoole\DDL\Filter\FilterZerofill;
use InvalidArgumentException;
/**
* 字段构造器
* Class Column
* @package EasySwoole\DDL\Blueprint
*/
class Column
{
protected $columnName; // 字段名称
protected $columnType; // 字段类型
protected $columnLimit; // 字段限制 如 INT(11) / decimal(10,2) 括号部分
protected $columnComment; // 字段注释
protected $columnCharset; // 字段编码
protected $isBinary; // 二进制 (只允许在字符串类型上设置)
protected $isUnique; // 唯一的 (请勿重复设置索引UNI)
protected $unsigned; // 无符号 (仅数字类型可以设置)
protected $zeroFill; // 零填充 (仅数字类型可以设置)
protected $defaultValue; // 默认值 (非TEXT/BLOB可以设置)
protected $isNotNull = true; // 字段可空 (默认已经设置全部字段不可空)
protected $autoIncrement; // 字段自增 (仅数字类型可以设置)
protected $isPrimaryKey; // 主键字段 (请勿重复设置索引PK)
/**
* Column constructor.
* @param string $columnName 列的名称
* @param string $columnType 列的类型
*/
function __construct(string $columnName, string $columnType)
{
$this->setColumnName($columnName);
$this->setColumnType($columnType);
}
/**
* 是否无符号
* @param bool $enable
* @return Column
*/
function setIsUnsigned(bool $enable = true): Column
{
// TODO 暂未做规范判断
// 同样需要做规范判断 字段为文本/日期时间/BLOB时不能设置为无符号
$this->unsigned = $enable;
return $this;
}
/**
* 是否值自增
* @param bool $enable
* @return Column
*/
function setIsAutoIncrement(bool $enable = true): Column
{
// TODO 暂未做规范判断
// 同样需要做规范判断 只有数字类型才允许自增
$this->autoIncrement = $enable;
return $this;
}
/**
* 转化为字符串
* @return string
*/
function __toString()
{
return $this->__createDDL();
}
/**
* 创建DDL
* 带下划线的方法请不要外部调用
* @return string
*/
function __createDDL(): string
{
FilterLimit::run($this);//检测limit是否合法
FilterUnsigned::run($this); //检测无符号类型
FilterZerofill::run($this); //检测是否补充长度
$default = $this->parseDefaultValue();
$columnCharset = $this->columnCharset ? explode('_', $this->columnCharset)[0] : false;
return implode(' ',
array_filter(
[
'`' . $this->columnName . '`',
(string)$this->parseDataType(),
$this->isBinary ? 'BINARY' : null,
$this->columnCharset ? 'CHARACTER SET ' . strtoupper($columnCharset) . ' COLLATE ' . strtoupper($this->columnCharset) : null,
$this->unsigned ? 'UNSIGNED' : null,
$this->zeroFill ? 'ZEROFILL' : null,
$this->isUnique ? 'UNIQUE' : null,
$this->isNotNull ? 'NOT NULL' : 'NULL',
$default !== false ? 'DEFAULT ' . $default : null,
$this->isPrimaryKey ? 'PRIMARY KEY' : null,
$this->autoIncrement ? 'AUTO_INCREMENT' : null,
$this->columnComment ? sprintf("COMMENT '%s'", addslashes($this->columnComment)) : null
]
)
);
}
/**
* 处理字段的默认值
* @return bool|string
*/
private function parseDefaultValue()
{
// AUTO_INCREMENT 和默认值不能同时出现
if ($this->autoIncrement) {
return false;
}
// 如果当前允许NULL值 而没有设置默认值 那么默认就为NULL
if (!$this->isNotNull && ($this->defaultValue == null || $this->defaultValue == 'NULL')) {
return 'NULL';
}
// 否则字段是不允许NULL值的 如果默认值是文本应该加入引号
if (is_string($this->defaultValue) && !DataType::typeIsDatetime($this->parseDataType())) {
return "'" . $this->defaultValue . "'";
} else if (is_bool($this->defaultValue)) { // 布尔类型强转0和1
return $this->defaultValue ? '1' : '0';
} else if (is_null($this->defaultValue)) {
return false;
} else if (DataType::typeIsDatetime($this->parseDataType())) { // 其他类型强转String
if (stripos($this->defaultValue, "CURRENT_TIMESTAMP") === false) {
return "'" . $this->defaultValue . "'";
}
return $this->defaultValue;
} else {
return (string)$this->defaultValue;
}
}
/**
* 处理数据类型
* @return string
*/
private function parseDataType()
{
$columnLimit = $this->parseColumnLimit();
$columnType = $this->columnType;
if ($columnLimit) {
$columnType .= $columnLimit;
}
return $columnType;
}
/**
* 处理字段的类型宽度限制
* @return bool|string
*/
private function parseColumnLimit()
{
// 是一个数组需要用逗号接起来
if (is_array($this->columnLimit)) {
return "(" . implode(',', $this->columnLimit) . ")";
}
// 是一个数字可以直接设置在类型后面
if (is_numeric($this->columnLimit)) {
return "(" . $this->columnLimit . ")";
}
// 否则没有设置
return false;
}
/**
* @return mixed
*/
public function getColumnName()
{
return $this->columnName;
}
/**
* 设置字段名称
* @param string $name 字段名称
* @return Column
*/
function setColumnName(string $name): Column
{
$name = trim($name);
if (empty($name)) {
throw new InvalidArgumentException('The column name cannot be empty');
}
$this->columnName = $name;
return $this;
}
/**
* @return mixed
*/
public function getColumnType()
{
return $this->columnType;
}
/**
* 设置字段类型
* @param string $type
* @return Column
*/
function setColumnType(string $type): Column
{
$type = trim($type);
if (!DataType::isValidValue($type)) {
throw new InvalidArgumentException('The column type ' . $type . ' is invalid');
}
$this->columnType = $type;
return $this;
}
/**
* @return mixed
*/
public function getColumnLimit()
{
return $this->columnLimit;
}
/**
* 设置字段列宽限制
* @param integer|array $limit
* @return Column
*/
function setColumnLimit($limit): Column
{
// TODO 暂未做规范判断
// 此处根据类型的不同实际上还应该判断 TEXT/BLOB 不可能存在limit
// 另外数字类型如 INT DisplayWidth < 256 | DECIMAL (1,5) 总精度必须大于小数部分精度等限制
$this->columnLimit = $limit;
return $this;
}
/**
* @return mixed
*/
public function getColumnComment()
{
return $this->columnComment;
}
/**
* 设置字段备注
* @param string $comment
* @return Column
*/
function setColumnComment(string $comment): Column
{
$this->columnComment = $comment;
return $this;
}
/**
* @return mixed
*/
public function getColumnCharset()
{
return $this->columnCharset;
}
/**
* 设置字段编码
* @param string $charset
* @return Column
*/
function setColumnCharset(string $charset): Column
{
$this->columnCharset = $charset;
return $this;
}
/**
* @return mixed
*/
public function getIsBinary()
{
return $this->isBinary;
}
/**
* 是否二进制
* 在字符列上设置了二进制会使得该列严格区分大小写
* @param bool $enable
* @return Column
*/
function setIsBinary(bool $enable = true): Column
{
// TODO 暂未做规范判断
// 同样需要做规范判断 只有字符串类型才允许二进制
$this->isBinary = $enable;
return $this;
}
/**
* @return mixed
*/
public function getIsUnique()
{
return $this->isUnique;
}
/**
* 字段设置为Unique
* 请不要和索引互相重复设置
* @param bool $enable
* @return Column
*/
function setIsUnique(bool $enable = true): Column
{
$this->isUnique = $enable;
return $this;
}
/**
* @return mixed
*/
public function getUnsigned()
{
return $this->unsigned;
}
/**
* @return mixed
*/
public function getZeroFill()
{
return $this->zeroFill;
}
/**
* 是否零填充
* @param bool $enable
* @return Column
*/
function setZeroFill(bool $enable = true): Column
{
$this->zeroFill = $enable;
return $this;
}
/**
* @return mixed
*/
public function getDefaultValue()
{
return $this->defaultValue;
}
/**
* 字段默认值
* @param $value
* @return Column
*/
function setDefaultValue($value): Column
{
// TODO 暂未做规范判断
// 同样需要做规范判断 字段为文本/BLOB时不能设置默认值
$this->defaultValue = $value;
return $this;
}
/**
* @return bool
*/
public function getIsNotNull(): bool
{
return $this->isNotNull;
}
/**
* 设置不可空
* @param bool $enable
* @return Column
*/
function setIsNotNull(bool $enable = true): Column
{
$this->isNotNull = $enable;
return $this;
}
/**
* @return mixed
*/
public function getAutoIncrement()
{
return $this->autoIncrement;
}
/**
* @return mixed
*/
public function getIsPrimaryKey()
{
return $this->isPrimaryKey;
}
/**
* 直接在字段上设置PK
* 请不要和索引互相重复设置
* @param bool $enable
* @return Column
*/
function setIsPrimaryKey(bool $enable = true): Column
{
$this->isPrimaryKey = $enable;
return $this;
}
}

132
extend/mysql_dll/easyswoole/ddl/src/Blueprint/Index.php

@ -0,0 +1,132 @@
<?php
namespace EasySwoole\DDL\Blueprint;
use \EasySwoole\DDL\Enum\Index as IndexType;
use InvalidArgumentException;
/**
* 索引构造器
* Class Index
* @package EasySwoole\DDL\Blueprint
*/
class Index
{
protected $indexName; // 索引名称
protected $indexType; // 索引类型 NORMAL PRI UNI FULLTEXT
protected $indexColumns; // 被索引的列 字符串或数组(多个列)
protected $indexComment; // 索引注释
/**
* Index constructor.
* @param string|null $indexName 不设置索引名可以传入NULL
* @param string $indexType 传入类型常量
* @param string|array $indexColumns 传入索引字段
*/
function __construct(?string $indexName, $indexType, $indexColumns)
{
$this->setIndexName($indexName);
$this->setIndexType($indexType);
$this->setIndexColumns($indexColumns);
}
/**
* 设置索引名称
* @param string $name
* @return Index
*/
function setIndexName(?string $name = null): Index
{
$name = is_string($name) ? trim($name) : null;
$this->indexName = $name;
return $this;
}
/**
* 设置索引类型
* @param string $type
* @return Index
*/
function setIndexType(string $type): Index
{
$type = trim($type);
if (!IndexType::isValidValue($type)) {
throw new InvalidArgumentException('The index type ' . $type . ' is invalid');
}
$this->indexType = $type;
return $this;
}
/**
* 设置索引字段
* @param string|array $columns 可以设置字符串和数组
* @return Index
*/
function setIndexColumns($columns): Index
{
$this->indexColumns = $columns;
return $this;
}
/**
* 设置索引备注
* @param string $comment
* @return Index
*/
function setIndexComment(string $comment): Index
{
$this->indexComment = $comment;
return $this;
}
/**
* 组装索引字段名
* @return string
*/
function parseIndexColumns()
{
$columnDDLs = [];
$indexColumns = $this->indexColumns;
if (is_string($indexColumns)) {
$indexColumns = array($indexColumns);
}
foreach ($indexColumns as $indexedColumn) {
$columnDDLs[] = '`' . $indexedColumn . '`';
}
return '(' . implode(',', $columnDDLs) . ')';
}
/**
* 生成索引DDL结构
* 带有下划线的方法请不要自行调用
* @return string
*/
function __createDDL()
{
$indexPrefix = [
IndexType::NORMAL => 'INDEX',
IndexType::UNIQUE => 'UNIQUE INDEX',
IndexType::PRIMARY => 'PRIMARY KEY',
IndexType::FULLTEXT => 'FULLTEXT INDEX',
];
return implode(' ',
array_filter(
[
$indexPrefix[$this->indexType],
$this->indexName !== null ? '`' . $this->indexName . '`' : null,
$this->parseIndexColumns(),
$this->indexComment ? "COMMENT '" . addslashes($this->indexComment) . "'" : null
]
)
);
}
/**
* 转化为字符串
* @return string
*/
function __toString()
{
return $this->__createDDL();
}
}

572
extend/mysql_dll/easyswoole/ddl/src/Blueprint/Table.php

@ -0,0 +1,572 @@
<?php
namespace EasySwoole\DDL\Blueprint;
use EasySwoole\DDL\Enum\Character;
use EasySwoole\DDL\Enum\DataType;
use EasySwoole\DDL\Enum\Engine as Engines;
use EasySwoole\DDL\Enum\Index as IndexType;
/**
* 创建表结构描述
* 暂只支持创建表 CREATE 结构
* Class Table
* @package EasySwoole\Mysqli\DDLBuilder\Blueprints
*/
class Table
{
// 基础属性
protected $table;
protected $comment;
protected $engine = Engines::INNODB;
protected $charset = Character::UTF8_GENERAL_CI;
// 结构定义
protected $columns = []; // 表的行定义
protected $indexes = []; // 表的索引
// 额外选项
protected $isTemporary = false; // 是否临时表
protected $ifNotExists = false; // 是否不存在才创建
protected $autoIncrement; // 默认自增从该值开始
/**
* Table constructor.
* @param $tableName
*/
function __construct($tableName)
{
$this->table = $tableName;
}
// 以下为字段构造方法
/**
* 整数 INT
* @param string $name 字段名称
* @param null|integer $limit INT 4Bytes(2^31)
* @return mixed
*/
function colInt(string $name, int $limit = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::INT);
$this->columns[$name]->setColumnLimit($limit);
return $this->columns[$name];
}
/**
* 创建一个列对象
* 继承可以改变返回的类对象以使用自定义对象
* @param string $columnName
* @param string $columnType
* @return Column
*/
protected function createColumn(string $columnName, string $columnType)
{
return new Column($columnName, $columnType);
}
/**
* 整数 BIGINT
* @param string $name 字段名称
* @param int|null $limit BIGINT 8Bytes(2^63)
* @return Column
*/
function colBigInt(string $name, int $limit = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::BIGINT);
$this->columns[$name]->setColumnLimit($limit);
return $this->columns[$name];
}
/**
* 整数 TINYINT
* @param string $name 字段名称
* @param int|null $limit TINYINT 1Bytes(2^7)
* @return Column
*/
function colTinyInt(string $name, int $limit = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::TINYINT);
$this->columns[$name]->setColumnLimit($limit);
return $this->columns[$name];
}
/**
* 整数 SMALLINT
* @param string $name 字段名称
* @param int|null $limit TINYINT 2Bytes(2^15)
* @return Column
*/
function colSmallInt(string $name, int $limit = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::SMALLINT);
$this->columns[$name]->setColumnLimit($limit);
return $this->columns[$name];
}
/**
* 整数 MEDIUMINT
* @param string $name 字段名称
* @param int|null $limit MEDIUMINT 3Bytes(2^23)
* @return Column
*/
function colMediumInt(string $name, int $limit = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::MEDIUMINT);
$this->columns[$name]->setColumnLimit($limit);
return $this->columns[$name];
}
/**
* 单精度浮点 - FLOAT
* : 当设置总精度为24-53内部实际上是DOUBLE序列
* @param string $name 字段名称
* @param int|null $precision 字段总精度(允许储存多少位数|含小数点)
* @param int|null $digits 小数点部分的精度(可空)
* @return Column
*/
function colFloat(string $name, int $precision = null, int $digits = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::FLOAT);
if (is_numeric($precision) && is_numeric($digits)) {
$this->columns[$name]->setColumnLimit([$precision, $digits]);
} elseif (is_numeric($precision)) {
$this->columns[$name]->setColumnLimit($precision);
}
return $this->columns[$name];
}
/**
* 双精度浮点 - DOUBLE
* @param string $name 字段名称
* @param int|null $precision 字段总精度(允许储存多少位数|含小数点)
* @param int|null $digits 小数点部分的精度(可空)
* @return Column
*/
function colDouble(string $name, int $precision = null, int $digits = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::DOUBLE);
if (is_numeric($precision) && is_numeric($digits)) {
$this->columns[$name]->setColumnLimit([$precision, $digits]);
} elseif (is_numeric($precision)) {
$this->columns[$name]->setColumnLimit($precision);
}
return $this->columns[$name];
}
/**
* 定点小数 - DECIMAL
* 注意当设置小数精度和总精度一致时整数部分只能为零
* : 当未设置精度时MYSQL默认按 DECIMAL(10,0) 所以此处给出默认值
* @param string $name 字段名称
* @param int $precision 字段总精度(允许储存多少位数|含小数点)
* @param int $digits 小数点部分的精度
* @return Column
*/
function colDecimal(string $name, int $precision = 10, int $digits = 0): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::DECIMAL);
$this->columns[$name]->setColumnLimit([$precision, $digits]);
return $this->columns[$name];
}
/**
* 日期时间 - DATE
* @param string $name 字段名称
* @return Column
*/
function colDate(string $name): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::DATE);
return $this->columns[$name];
}
/**
* 日期时间 - YEAR
* @param string $name 字段名称
* @return Column
*/
function colYear(string $name): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::YEAR);
return $this->columns[$name];
}
/**
* 日期时间 - TIME
* @param string $name 字段名称
* @param int|null $fsp 精度分数(详见MYSQL文档)
* @return Column
*/
function colTime(string $name, ?int $fsp = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::TIME);
if (is_numeric($fsp)) $this->columns[$name]->setColumnLimit($fsp);
return $this->columns[$name];
}
/**
* 日期时间 - DATETIME
* @param string $name 字段名称
* @param int|null $fsp 精度分数(详见MYSQL文档)
* @return Column
*/
function colDateTime(string $name, ?int $fsp = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::DATETIME);
if (is_numeric($fsp)) $this->columns[$name]->setColumnLimit($fsp);
return $this->columns[$name];
}
/**
* 日期时间 - TIMESTAMP
* @param string $name 字段名称
* @param int|null $fsp 精度分数(详见MYSQL文档)
* @return Column
*/
function colTimestamp(string $name, ?int $fsp = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::TIMESTAMP);
if (is_numeric($fsp)) $this->columns[$name]->setColumnLimit($fsp);
return $this->columns[$name];
}
/**
* 字符串 - CHAR
* @param string $name 字段名称
* @param int|null $limit
* @return Column
*/
function colChar(string $name, ?int $limit = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::CHAR);
$this->columns[$name]->setColumnLimit($limit);
return $this->columns[$name];
}
/**
* 字符串 - VARCHAR
* @param string $name 字段名称
* @param int|null $limit
* @return Column
*/
function colVarChar(string $name, ?int $limit = null): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::VARCHAR);
$this->columns[$name]->setColumnLimit($limit);
return $this->columns[$name];
}
/**
* 字符串 - TEXT
* @param string $name 字段名称
* @return Column
*/
function colText(string $name): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::TEXT);
return $this->columns[$name];
}
/**
* 字符串 - TINYTEXT
* @param string $name 字段名称
* @return Column
*/
function colTinyText(string $name): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::TINYTEXT);
return $this->columns[$name];
}
/**
* 字符串 - LONGTEXT
* @param string $name 字段名称
* @return Column
*/
function colLongText(string $name): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::LONGTEXT);
return $this->columns[$name];
}
/**
* 字符串 - MEDIUMTEXT
* @param string $name 字段名称
* @return Column
*/
function colMediumText(string $name): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::MEDIUMTEXT);
return $this->columns[$name];
}
/**
* 二进制字符串 - BLOB
* @param string $name 字段名称
* @return Column
*/
function colBlob(string $name): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::BLOB);
return $this->columns[$name];
}
/**
* 二进制字符串 - LONGBLOB
* @param string $name 字段名称
* @return Column
*/
function colLongBlob(string $name): Column
{
$this->columns[$name] = $this->createColumn($name, DataType::LONGBLOB);
return $this->columns[$name];
}
/**
* 二进制字符串 - TINYBLOB
* @param string $name 字段名称
* @return mixed
*/
function colTinyBlob(string $name)
{
$this->columns[$name] = $this->createColumn($name, DataType::TINYBLOB);
return $this->columns[$name];
}
// 以下为索引构造方法
/**
* 二进制字符串 - MEDIUMBLOB
* @param string $name 字段名称
* @return mixed
*/
function colMediumBlob(string $name)
{
$this->columns[$name] = $this->createColumn($name, DataType::MEDIUMBLOB);
return $this->columns[$name];
}
/**
* 普通索引
* @param string|null $name 索引名称(不需要名称也可以传null)
* @param string|array $columns 索引字段(多个字段可以传入数组)
* @return mixed
*/
function indexNormal(string $name, $columns): Index
{
$this->indexes[$name] = $this->createIndex($name, IndexType::NORMAL, $columns);
return $this->indexes[$name];
}
/**
* 创建一个索引对象
* 继承可以改变返回的类对象以使用自定义对象
* @param string|null $indexName
* @param $indexType
* @param $indexColumns
* @return Index
*/
protected function createIndex(?string $indexName, $indexType, $indexColumns)
{
return new Index($indexName, $indexType, $indexColumns);
}
/**
* 唯一索引
* 请注意这属于约束的一种类型 不要和字段上的约束重复定义
* @param string|null $name 索引名称(不需要名称也可以传null)
* @param string|array $columns 索引字段(多个字段可以传入数组)
* @return mixed
*/
function indexUnique(string $name, $columns): Index
{
$this->indexes[$name] = $this->createIndex($name, IndexType::UNIQUE, $columns);
return $this->indexes[$name];
}
// 以下为表本身属性的设置方法
/**
* 主键索引
* 请注意这属于约束的一种类型 不要和字段上的约束重复定义
* @param string|null $name 索引名称(不需要名称也可以传null)
* @param string|array $columns 索引字段(多个字段可以传入数组)
* @return mixed
*/
function indexPrimary(string $name, $columns): Index
{
$this->indexes[$name] = $this->createIndex($name, IndexType::PRIMARY, $columns);
return $this->indexes[$name];
}
/**
* 全文索引
* 请注意该类型的索引只能施加在TEXT类型的字段上
* @param string|null $name 索引名称(不需要名称也可以传null)
* @param string|array $columns 索引字段(多个字段可以传入数组)
* @return mixed
*/
function indexFullText(string $name, $columns): Index
{
$this->indexes[$name] = $this->createIndex($name, IndexType::FULLTEXT, $columns);
return $this->indexes[$name];
}
/**
* 这是一个临时表
* @param bool $enable
* @return Table
*/
function setIsTemporary($enable = true): Table
{
$this->isTemporary = $enable;
return $this;
}
/**
* CREATE IF NOT EXISTS
* @param bool $enable
* @return Table
*/
function setIfNotExists($enable = true): Table
{
$this->ifNotExists = $enable;
return $this;
}
/**
* 设置表名称
* @param string $name
* @return Table
*/
function setTableName(string $name): Table
{
$name = trim($name);
if (empty($name)) {
throw new \InvalidArgumentException('The table name cannot be empty');
}
$this->table = $name;
return $this;
}
/**
* 设置储存引擎
* @param string $engine
* @return Table
*/
function setTableEngine(string $engine): Table
{
$engine = trim($engine);
if (!Engines::isValidValue($engine)) {
throw new \InvalidArgumentException('The engine ' . $engine . ' is invalid');
}
$this->engine = $engine;
return $this;
}
/**
* 设置表注释
* @param string $comment
* @return Table
*/
function setTableComment(string $comment): Table
{
$this->comment = $comment;
return $this;
}
/**
* 设置表字符集
* @param string $charset
* @return Table
*/
function setTableCharset(string $charset): Table
{
$charset = trim($charset);
if (!Character::isValidValue($charset)) {
throw new \InvalidArgumentException('The character ' . $charset . ' is invalid');
}
$this->charset = $charset;
return $this;
}
// 生成表结构 带有下划线的方法请不要自行调用
/**
* 设置起始自增值
* @param int $startIncrement
*/
function setTableAutoIncrement(int $startIncrement)
{
$this->autoIncrement = $startIncrement;
}
function __getCols()
{
// 表格字段定义
$columnDefinitions = [];
foreach ($this->columns as $name => $column) {
$columnDefinitions[$name] = ' ' . (string)$column;
}
return $columnDefinitions;
}
/**
* 转化为字符串
* @return string
*/
function __toString()
{
return $this->__createDDL();
}
function __createDDL()
{
// 表名称定义
$tableName = "`{$this->table}`"; // 安全起见引号包裹
// 表格字段定义
$columnDefinitions = [];
foreach ($this->columns as $name => $column) {
$columnDefinitions[] = ' ' . (string)$column;
}
// 表格索引定义
$indexDefinitions = [];
foreach ($this->indexes as $name => $index) {
$indexDefinitions[] = ' ' . (string)$index;
}
// 表格属性定义
$tableOptions = array_filter(
[
$this->engine ? 'ENGINE = ' . strtoupper($this->engine) : null,
$this->charset ? "DEFAULT COLLATE = '" . $this->charset . "'" : null,
$this->comment ? "COMMENT = '" . addslashes($this->comment) . "'" : null
]
);
$ifNotExists = $this->ifNotExists ? 'IF NOT EXISTS ' : '';
// 构建表格DDL
$createDDL = implode(
"\n",
array_filter(
[
"CREATE TABLE {$ifNotExists}{$tableName} (",
implode(",\n",
array_merge(
$columnDefinitions,
$indexDefinitions
)
),
')',
implode(" ", $tableOptions),
]
)
) . ';';
return $createDDL;
}
}

17
extend/mysql_dll/easyswoole/ddl/src/Contracts/FilterInterface.php

@ -0,0 +1,17 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 17:24
*/
namespace EasySwoole\DDL\Contracts;
use EasySwoole\DDL\Blueprint\Column;
interface FilterInterface
{
public static function run(Column $column);
}

33
extend/mysql_dll/easyswoole/ddl/src/DDLBuilder.php

@ -0,0 +1,33 @@
<?php
namespace EasySwoole\DDL;
use EasySwoole\DDL\Blueprint\Table;
/**
* 语句生成器
* Class DDLBuilder
* @package EasySwoole\DDL
*/
class DDLBuilder
{
/**
* 生成建表语句
* @param string $table 表名称
* @param callable $callable 在闭包中描述创建过程
* @return string 返回生成的DDL语句
*/
static function table($table, callable $callable)
{
$blueprint = new Table($table);
$callable($blueprint);
return $blueprint->__createDDL();
}
static function cols(callable $callable)
{
$blueprint = new Table("");
$callable($blueprint);
return $blueprint->__getCols();
}
}

236
extend/mysql_dll/easyswoole/ddl/src/Enum/Character.php

@ -0,0 +1,236 @@
<?php
namespace EasySwoole\DDL\Enum;
use EasySwoole\Spl\SplEnum;
/**
* 字符集类型枚举
* Class Character
* @package EasySwoole\DDL\Enum
*/
class Character extends SplEnum
{
const ARMSCII8_BIN = 'armscii8_bin';
const ARMSCII8_GENERAL_CI = 'armscii8_general_ci';
const ASCII_BIN = 'ascii_bin';
const ASCII_GENERAL_CI = 'ascii_general_ci';
const BIG5_BIN = 'big5_bin';
const BIG5_CHINESE_CI = 'big5_chinese_ci';
const BINARY = 'binary';
const CP1250_BIN = 'cp1250_bin';
const CP1250_CROATIAN_CI = 'cp1250_croatian_ci';
const CP1250_CZECH_CS = 'cp1250_czech_cs';
const CP1250_GENERAL_CI = 'cp1250_general_ci';
const CP1250_POLISH_CI = 'cp1250_polish_ci';
const CP1251_BIN = 'cp1251_bin';
const CP1251_BULGARIAN_CI = 'cp1251_bulgarian_ci';
const CP1251_GENERAL_CI = 'cp1251_general_ci';
const CP1251_GENERAL_CS = 'cp1251_general_cs';
const CP1251_UKRAINIAN_CI = 'cp1251_ukrainian_ci';
const CP1256_BIN = 'cp1256_bin';
const CP1256_GENERAL_CI = 'cp1256_general_ci';
const CP1257_BIN = 'cp1257_bin';
const CP1257_GENERAL_CI = 'cp1257_general_ci';
const CP1257_LITHUANIAN_CI = 'cp1257_lithuanian_ci';
const CP850_BIN = 'cp850_bin';
const CP850_GENERAL_CI = 'cp850_general_ci';
const CP852_BIN = 'cp852_bin';
const CP852_GENERAL_CI = 'cp852_general_ci';
const CP866_BIN = 'cp866_bin';
const CP866_GENERAL_CI = 'cp866_general_ci';
const CP932_BIN = 'cp932_bin';
const CP932_JAPANESE_CI = 'cp932_japanese_ci';
const DEC8_BIN = 'dec8_bin';
const DEC8_SWEDISH_CI = 'dec8_swedish_ci';
const EUCJPMS_BIN = 'eucjpms_bin';
const EUCJPMS_JAPANESE_CI = 'eucjpms_japanese_ci';
const EUCKR_BIN = 'euckr_bin';
const EUCKR_KOREAN_CI = 'euckr_korean_ci';
const GB18030_BIN = 'gb18030_bin';
const GB18030_CHINESE_CI = 'gb18030_chinese_ci';
const GB18030_UNICODE_520_CI = 'gb18030_unicode_520_ci';
const GB2312_BIN = 'gb2312_bin';
const GB2312_CHINESE_CI = 'gb2312_chinese_ci';
const GBK_BIN = 'gbk_bin';
const GBK_CHINESE_CI = 'gbk_chinese_ci';
const GEOSTD8_BIN = 'geostd8_bin';
const GEOSTD8_GENERAL_CI = 'geostd8_general_ci';
const GREEK_BIN = 'greek_bin';
const GREEK_GENERAL_CI = 'greek_general_ci';
const HEBREW_BIN = 'hebrew_bin';
const HEBREW_GENERAL_CI = 'hebrew_general_ci';
const HP8_BIN = 'hp8_bin';
const HP8_ENGLISH_CI = 'hp8_english_ci';
const KEYBCS2_BIN = 'keybcs2_bin';
const KEYBCS2_GENERAL_CI = 'keybcs2_general_ci';
const KOI8R_BIN = 'koi8r_bin';
const KOI8R_GENERAL_CI = 'koi8r_general_ci';
const KOI8U_BIN = 'koi8u_bin';
const KOI8U_GENERAL_CI = 'koi8u_general_ci';
const LATIN1_BIN = 'latin1_bin';
const LATIN1_DANISH_CI = 'latin1_danish_ci';
const LATIN1_GENERAL_CI = 'latin1_general_ci';
const LATIN1_GENERAL_CS = 'latin1_general_cs';
const LATIN1_GERMAN1_CI = 'latin1_german1_ci';
const LATIN1_GERMAN2_CI = 'latin1_german2_ci';
const LATIN1_SPANISH_CI = 'latin1_spanish_ci';
const LATIN1_SWEDISH_CI = 'latin1_swedish_ci';
const LATIN2_BIN = 'latin2_bin';
const LATIN2_CROATIAN_CI = 'latin2_croatian_ci';
const LATIN2_CZECH_CS = 'latin2_czech_cs';
const LATIN2_GENERAL_CI = 'latin2_general_ci';
const LATIN2_HUNGARIAN_CI = 'latin2_hungarian_ci';
const LATIN5_BIN = 'latin5_bin';
const LATIN5_TURKISH_CI = 'latin5_turkish_ci';
const LATIN7_BIN = 'latin7_bin';
const LATIN7_ESTONIAN_CS = 'latin7_estonian_cs';
const LATIN7_GENERAL_CI = 'latin7_general_ci';
const LATIN7_GENERAL_CS = 'latin7_general_cs';
const MACCE_BIN = 'macce_bin';
const MACCE_GENERAL_CI = 'macce_general_ci';
const MACROMAN_BIN = 'macroman_bin';
const MACROMAN_GENERAL_CI = 'macroman_general_ci';
const SJIS_BIN = 'sjis_bin';
const SJIS_JAPANESE_CI = 'sjis_japanese_ci';
const SWE7_BIN = 'swe7_bin';
const SWE7_SWEDISH_CI = 'swe7_swedish_ci';
const TIS620_BIN = 'tis620_bin';
const TIS620_THAI_CI = 'tis620_thai_ci';
const UCS2_BIN = 'ucs2_bin';
const UCS2_CROATIAN_CI = 'ucs2_croatian_ci';
const UCS2_CZECH_CI = 'ucs2_czech_ci';
const UCS2_DANISH_CI = 'ucs2_danish_ci';
const UCS2_ESPERANTO_CI = 'ucs2_esperanto_ci';
const UCS2_ESTONIAN_CI = 'ucs2_estonian_ci';
const UCS2_GENERAL_CI = 'ucs2_general_ci';
const UCS2_GENERAL_MYSQL500_CI = 'ucs2_general_mysql500_ci';
const UCS2_GERMAN2_CI = 'ucs2_german2_ci';
const UCS2_HUNGARIAN_CI = 'ucs2_hungarian_ci';
const UCS2_ICELANDIC_CI = 'ucs2_icelandic_ci';
const UCS2_LATVIAN_CI = 'ucs2_latvian_ci';
const UCS2_LITHUANIAN_CI = 'ucs2_lithuanian_ci';
const UCS2_PERSIAN_CI = 'ucs2_persian_ci';
const UCS2_POLISH_CI = 'ucs2_polish_ci';
const UCS2_ROMAN_CI = 'ucs2_roman_ci';
const UCS2_ROMANIAN_CI = 'ucs2_romanian_ci';
const UCS2_SINHALA_CI = 'ucs2_sinhala_ci';
const UCS2_SLOVAK_CI = 'ucs2_slovak_ci';
const UCS2_SLOVENIAN_CI = 'ucs2_slovenian_ci';
const UCS2_SPANISH2_CI = 'ucs2_spanish2_ci';
const UCS2_SPANISH_CI = 'ucs2_spanish_ci';
const UCS2_SWEDISH_CI = 'ucs2_swedish_ci';
const UCS2_TURKISH_CI = 'ucs2_turkish_ci';
const UCS2_UNICODE_520_CI = 'ucs2_unicode_520_ci';
const UCS2_UNICODE_CI = 'ucs2_unicode_ci';
const UCS2_VIETNAMESE_CI = 'ucs2_vietnamese_ci';
const UJIS_BIN = 'ujis_bin';
const UJIS_JAPANESE_CI = 'ujis_japanese_ci';
const UTF16_BIN = 'utf16_bin';
const UTF16_CROATIAN_CI = 'utf16_croatian_ci';
const UTF16_CZECH_CI = 'utf16_czech_ci';
const UTF16_DANISH_CI = 'utf16_danish_ci';
const UTF16_ESPERANTO_CI = 'utf16_esperanto_ci';
const UTF16_ESTONIAN_CI = 'utf16_estonian_ci';
const UTF16_GENERAL_CI = 'utf16_general_ci';
const UTF16_GERMAN2_CI = 'utf16_german2_ci';
const UTF16_HUNGARIAN_CI = 'utf16_hungarian_ci';
const UTF16_ICELANDIC_CI = 'utf16_icelandic_ci';
const UTF16_LATVIAN_CI = 'utf16_latvian_ci';
const UTF16_LITHUANIAN_CI = 'utf16_lithuanian_ci';
const UTF16_PERSIAN_CI = 'utf16_persian_ci';
const UTF16_POLISH_CI = 'utf16_polish_ci';
const UTF16_ROMAN_CI = 'utf16_roman_ci';
const UTF16_ROMANIAN_CI = 'utf16_romanian_ci';
const UTF16_SINHALA_CI = 'utf16_sinhala_ci';
const UTF16_SLOVAK_CI = 'utf16_slovak_ci';
const UTF16_SLOVENIAN_CI = 'utf16_slovenian_ci';
const UTF16_SPANISH2_CI = 'utf16_spanish2_ci';
const UTF16_SPANISH_CI = 'utf16_spanish_ci';
const UTF16_SWEDISH_CI = 'utf16_swedish_ci';
const UTF16_TURKISH_CI = 'utf16_turkish_ci';
const UTF16_UNICODE_520_CI = 'utf16_unicode_520_ci';
const UTF16_UNICODE_CI = 'utf16_unicode_ci';
const UTF16_VIETNAMESE_CI = 'utf16_vietnamese_ci';
const UTF16LE_BIN = 'utf16le_bin';
const UTF16LE_GENERAL_CI = 'utf16le_general_ci';
const UTF32_BIN = 'utf32_bin';
const UTF32_CROATIAN_CI = 'utf32_croatian_ci';
const UTF32_CZECH_CI = 'utf32_czech_ci';
const UTF32_DANISH_CI = 'utf32_danish_ci';
const UTF32_ESPERANTO_CI = 'utf32_esperanto_ci';
const UTF32_ESTONIAN_CI = 'utf32_estonian_ci';
const UTF32_GENERAL_CI = 'utf32_general_ci';
const UTF32_GERMAN2_CI = 'utf32_german2_ci';
const UTF32_HUNGARIAN_CI = 'utf32_hungarian_ci';
const UTF32_ICELANDIC_CI = 'utf32_icelandic_ci';
const UTF32_LATVIAN_CI = 'utf32_latvian_ci';
const UTF32_LITHUANIAN_CI = 'utf32_lithuanian_ci';
const UTF32_PERSIAN_CI = 'utf32_persian_ci';
const UTF32_POLISH_CI = 'utf32_polish_ci';
const UTF32_ROMAN_CI = 'utf32_roman_ci';
const UTF32_ROMANIAN_CI = 'utf32_romanian_ci';
const UTF32_SINHALA_CI = 'utf32_sinhala_ci';
const UTF32_SLOVAK_CI = 'utf32_slovak_ci';
const UTF32_SLOVENIAN_CI = 'utf32_slovenian_ci';
const UTF32_SPANISH2_CI = 'utf32_spanish2_ci';
const UTF32_SPANISH_CI = 'utf32_spanish_ci';
const UTF32_SWEDISH_CI = 'utf32_swedish_ci';
const UTF32_TURKISH_CI = 'utf32_turkish_ci';
const UTF32_UNICODE_520_CI = 'utf32_unicode_520_ci';
const UTF32_UNICODE_CI = 'utf32_unicode_ci';
const UTF32_VIETNAMESE_CI = 'utf32_vietnamese_ci';
const UTF8_BIN = 'utf8_bin';
const UTF8_CROATIAN_CI = 'utf8_croatian_ci';
const UTF8_CZECH_CI = 'utf8_czech_ci';
const UTF8_DANISH_CI = 'utf8_danish_ci';
const UTF8_ESPERANTO_CI = 'utf8_esperanto_ci';
const UTF8_ESTONIAN_CI = 'utf8_estonian_ci';
const UTF8_GENERAL_CI = 'utf8_general_ci';
const UTF8_GENERAL_MYSQL500_CI = 'utf8_general_mysql500_ci';
const UTF8_GERMAN2_CI = 'utf8_german2_ci';
const UTF8_HUNGARIAN_CI = 'utf8_hungarian_ci';
const UTF8_ICELANDIC_CI = 'utf8_icelandic_ci';
const UTF8_LATVIAN_CI = 'utf8_latvian_ci';
const UTF8_LITHUANIAN_CI = 'utf8_lithuanian_ci';
const UTF8_PERSIAN_CI = 'utf8_persian_ci';
const UTF8_POLISH_CI = 'utf8_polish_ci';
const UTF8_ROMAN_CI = 'utf8_roman_ci';
const UTF8_ROMANIAN_CI = 'utf8_romanian_ci';
const UTF8_SINHALA_CI = 'utf8_sinhala_ci';
const UTF8_SLOVAK_CI = 'utf8_slovak_ci';
const UTF8_SLOVENIAN_CI = 'utf8_slovenian_ci';
const UTF8_SPANISH2_CI = 'utf8_spanish2_ci';
const UTF8_SPANISH_CI = 'utf8_spanish_ci';
const UTF8_SWEDISH_CI = 'utf8_swedish_ci';
const UTF8_TURKISH_CI = 'utf8_turkish_ci';
const UTF8_UNICODE_520_CI = 'utf8_unicode_520_ci';
const UTF8_UNICODE_CI = 'utf8_unicode_ci';
const UTF8_VIETNAMESE_CI = 'utf8_vietnamese_ci';
const UTF8MB4_BIN = 'utf8mb4_bin';
const UTF8MB4_CROATIAN_CI = 'utf8mb4_croatian_ci';
const UTF8MB4_CZECH_CI = 'utf8mb4_czech_ci';
const UTF8MB4_DANISH_CI = 'utf8mb4_danish_ci';
const UTF8MB4_ESPERANTO_CI = 'utf8mb4_esperanto_ci';
const UTF8MB4_ESTONIAN_CI = 'utf8mb4_estonian_ci';
const UTF8MB4_GENERAL_CI = 'utf8mb4_general_ci';
const UTF8MB4_GERMAN2_CI = 'utf8mb4_german2_ci';
const UTF8MB4_HUNGARIAN_CI = 'utf8mb4_hungarian_ci';
const UTF8MB4_ICELANDIC_CI = 'utf8mb4_icelandic_ci';
const UTF8MB4_LATVIAN_CI = 'utf8mb4_latvian_ci';
const UTF8MB4_LITHUANIAN_CI = 'utf8mb4_lithuanian_ci';
const UTF8MB4_PERSIAN_CI = 'utf8mb4_persian_ci';
const UTF8MB4_POLISH_CI = 'utf8mb4_polish_ci';
const UTF8MB4_ROMAN_CI = 'utf8mb4_roman_ci';
const UTF8MB4_ROMANIAN_CI = 'utf8mb4_romanian_ci';
const UTF8MB4_SINHALA_CI = 'utf8mb4_sinhala_ci';
const UTF8MB4_SLOVAK_CI = 'utf8mb4_slovak_ci';
const UTF8MB4_SLOVENIAN_CI = 'utf8mb4_slovenian_ci';
const UTF8MB4_SPANISH2_CI = 'utf8mb4_spanish2_ci';
const UTF8MB4_SPANISH_CI = 'utf8mb4_spanish_ci';
const UTF8MB4_SWEDISH_CI = 'utf8mb4_swedish_ci';
const UTF8MB4_TURKISH_CI = 'utf8mb4_turkish_ci';
const UTF8MB4_UNICODE_520_CI = 'utf8mb4_unicode_520_ci';
const UTF8MB4_UNICODE_CI = 'utf8mb4_unicode_ci';
const UTF8MB4_VIETNAMESE_CI = 'utf8mb4_vietnamese_ci';
}

155
extend/mysql_dll/easyswoole/ddl/src/Enum/DataType.php

@ -0,0 +1,155 @@
<?php
namespace EasySwoole\DDL\Enum;
use EasySwoole\Spl\SplEnum;
/**
* 字段类型枚举
* Class DataType
* @package EasySwoole\DDL\Enum
*/
class DataType extends SplEnum
{
// 整型
const INT = 'int';
const INTEGER = 'integer';
const BIGINT = 'bigint';
const TINYINT = 'tinyint';
const SMALLINT = 'smallint';
const MEDIUMINT = 'mediumint';
// 小数 前面的要大于后面的
const FLOAT = 'float';
const DOUBLE = 'double';
const DECIMAL = 'decimal';
// 时间
const DATE = 'date';
const TIME = 'time';
const YEAR = 'year';
const DATETIME = 'datetime';
const TIMESTAMP = 'timestamp';
// 字符
const CHAR = 'char';
const TEXT = 'text';
const VARCHAR = 'varchar';
const TINYTEXT = 'tinytext';
const MEDIUMTEXT = 'mediumtext';
const LONGTEXT = 'longtext';
// 二进制大对象
const BLOB = 'blob';
const TINYBLOB = 'tinyblob';
const MEDIUMBLOB = 'mediumblob';
const LONGBLOB = 'longblob';
const BINARY = 'binary';
const VARBINARY = 'varbinary';
const JSON = 'json';
const BIT = 'bit';
const ENUM = 'enum';
const GEOMETRY = 'geometry';
const GEOMETRYCOLLECTION = 'geometrycollection';
const LINESTRING = 'linestring';
const MULTILINESTRING = 'multilinestring';
const MULTIPOINT = 'multipoint';
const MULTIPOLYGON = 'multipolygon';
const NUMERIC = 'numeric';
const POINT = 'point';
const POLYGON = 'polygon';
const REAL = 'real';
const SET = 'set';
/**
* 是否数字类型
* @param string $type
* @return bool
*/
public static function typeIsNumeric(string $type)
{
// 全部数字类型
$numericTypes = [
DataType::INT,
DataType::INTEGER,
DataType::BIGINT,
DataType::TINYINT,
DataType::SMALLINT,
DataType::MEDIUMINT,
DataType::FLOAT,
DataType::DOUBLE,
DataType::DECIMAL
];
return in_array($type, $numericTypes);
}
/**
* 是否文本类型
* @param string $type
* @return bool
*/
public static function typeIsTextual(string $type)
{
// 全部文本类型
$textualType = [
DataType::CHAR,
DataType::TEXT,
DataType::VARCHAR,
DataType::TINYTEXT,
DataType::LONGTEXT,
DataType::MEDIUMTEXT
];
return in_array($type, $textualType);
}
/**
* 是否二进制类型
* @param string $type
* @return bool
*/
public static function typeIsBinary(string $type)
{
// 全部二进制类型
$binaryType = [
DataType::BLOB,
DataType::TINYBLOB,
DataType::LONGBLOB,
DataType::MEDIUMBLOB
];
return in_array($type, $binaryType);
}
/**
* 是否时间日期类型
* @param string $type
* @return bool
*/
public static function typeIsDatetime(string $type)
{
// 全部时间日期类型
$datetimeType = [
DataType::DATE,
DataType::TIME,
DataType::YEAR,
DataType::DATETIME,
DataType::TIMESTAMP,
];
return in_array(strtolower($type), $datetimeType);
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Enum/Engine.php

@ -0,0 +1,23 @@
<?php
namespace EasySwoole\DDL\Enum;
use EasySwoole\Spl\SplEnum;
/**
* 储存引擎类型枚举
* Class Engine
* @package EasySwoole\DDL\Enum
*/
class Engine extends SplEnum
{
const CSV = 'csv';
const INNODB = 'innodb';
const MEMORY = 'memory';
const MYISAM = 'myisam';
const ARCHIVE = 'archive';
const FEDERATED = 'federated';
const BLACKHOLE = 'blackhole';
const MRG_MYISAM = 'mrg_myisam';
const PERFORMANCE_SCHEMA = 'performance_schema';
}

49
extend/mysql_dll/easyswoole/ddl/src/Enum/Func.php

@ -0,0 +1,49 @@
<?php
namespace EasySwoole\DDL\Enum;
/**
* 函数对象
* Class Func
* @package EasySwoole\DDL\Enum
*/
class Func
{
protected $definition;
/**
* Func constructor.
* @param $definition
*/
function __construct($definition)
{
$this->definition = $definition;
}
/**
* Definition Getter
* @return mixed
*/
public function getDefinition()
{
return $this->definition;
}
/**
* Definition Setter
* @param mixed $definition
*/
public function setDefinition($definition): void
{
$this->definition = $definition;
}
/**
* 转为字符串
* @return string
*/
function __toString()
{
return (string)$this->definition;
}
}

18
extend/mysql_dll/easyswoole/ddl/src/Enum/Index.php

@ -0,0 +1,18 @@
<?php
namespace EasySwoole\DDL\Enum;
use EasySwoole\Spl\SplEnum;
/**
* 索引类型枚举
* Class Index
* @package EasySwoole\DDL\Enum
*/
class Index extends SplEnum
{
const NORMAL = 'normal';
const UNIQUE = 'unique';
const PRIMARY = 'primary';
const FULLTEXT = 'fulltext';
}

21
extend/mysql_dll/easyswoole/ddl/src/Filter/FilterLimit.php

@ -0,0 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/17
* Time: 10:03
*/
namespace EasySwoole\DDL\Filter;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterLimit implements FilterInterface
{
public static function run(Column $column)
{
call_user_func(['EasySwoole\\DDL\\Filter\\Limit\\Filter' . ucfirst($column->getColumnType()), 'run'], $column);
}
}

21
extend/mysql_dll/easyswoole/ddl/src/Filter/FilterUnsigned.php

@ -0,0 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/17
* Time: 10:03
*/
namespace EasySwoole\DDL\Filter;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterUnsigned implements FilterInterface
{
public static function run(Column $column)
{
call_user_func(['EasySwoole\\DDL\\Filter\\Unsigned\\Filter' . ucfirst($column->getColumnType()), 'run'], $column);
}
}

21
extend/mysql_dll/easyswoole/ddl/src/Filter/FilterZerofill.php

@ -0,0 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/17
* Time: 10:03
*/
namespace EasySwoole\DDL\Filter;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterZerofill implements FilterInterface
{
public static function run(Column $column)
{
call_user_func(['EasySwoole\\DDL\\Filter\\Zerofill\\Filter' . ucfirst($column->getColumnType()), 'run'], $column);
}
}

41
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterBigint.php

@ -0,0 +1,41 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:44
*/
namespace EasySwoole\DDL\Filter;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterBigint implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 255) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type bigint(limit), limit must be range 1 to 255');
}
}
public static function limit(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 255) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type bigint(limit), limit must be range 1 to 255');
}
}
public static function unsigned(Column $column)
{
}
public static function zerofill(Column $column)
{
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterBlob.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:59
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterBlob implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type blob no require fsp ');
}
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterChar.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:50
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterChar implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 255) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type char(limit), limit must be range 1 to 255');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterDate.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:50
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterDate implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type date no require fsp ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterDatetime.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:49
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterDatetime implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 6) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type datetime(fsp), fsp must be range 0 to 6');
}
}
}

27
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterDecimal.php

@ -0,0 +1,27 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:48
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterDecimal implements FilterInterface
{
public static function run(Column $column)
{
if (!is_array($column->getColumnLimit())) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type decimal(M,D), params is error');
}
list($precision, $digits) = $column->getColumnLimit();
if (is_numeric($precision) && is_numeric($digits) && ($digits > $precision)) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type decimal(M,D), M must be >= D');
}
}
}

29
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterDouble.php

@ -0,0 +1,29 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:48
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterDouble implements FilterInterface
{
public static function run(Column $column)
{
if (is_array($column->getColumnLimit())) {
list($precision, $digits) = $column->getColumnLimit();
if (is_numeric($precision) && is_numeric($digits) && ($digits > $precision)) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type double(M,D), M must be >= D');
}
} elseif ($column->getColumnLimit() < 0) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type double(M), M must be >= 0');
}
}
}

28
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterFloat.php

@ -0,0 +1,28 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:48
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterFloat implements FilterInterface
{
public static function run(Column $column)
{
if (is_array($column->getColumnLimit())) {
list($precision, $digits) = $column->getColumnLimit();
if (is_numeric($precision) && is_numeric($digits) && ($digits > $precision)) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type double(M,D), M must be >= D');
}
} elseif ($column->getColumnLimit() < 0) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type double(M), M must be >= 0');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterInt.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:44
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterInt implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 255) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type int(limit), limit must be range 1 to 255');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterLongblob.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 17:01
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterLongblob implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type longblob no require fsp ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterLongtext.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:58
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterLongtext implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type longtext no require fsp ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterMediumblob.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 17:00
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterMediumblob implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type mediumblob no require fsp ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterMediumint.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:45
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterMediumint implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 255) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type mediumint(limit), limit must be range 1 to 255');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterMediumtext.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:57
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterMediumtext implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type mediumtext no require fsp ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterSmallint.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:46
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterSmallint implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 255) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type smallint(limit), limit must be range 1 to 255');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterText.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:56
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterText implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type text no require fsp ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTime.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:50
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTime implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 6) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type time(fsp), fsp must be range 0 to 6');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTimestamp.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:49
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTimestamp implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 6) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type timestamp(fsp), fsp must be range 0 to 6');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTinyblob.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:59
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTinyblob implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type tinyblob no require fsp ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTinyint.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:47
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTinyint implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 255) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type tinyint(limit), limit must be range 1 to 255');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterTinytext.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:57
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTinytext implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type tinytext no require fsp ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterVarchar.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:50
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterVarchar implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit() < 0 || $column->getColumnLimit() > 65535) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type varchar(limit), limit must be range 1 to 255');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Limit/FilterYear.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:55
*/
namespace EasySwoole\DDL\Filter\Limit;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterYear implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getColumnLimit()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type year no require fsp ');
}
}
}

21
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterBigint.php

@ -0,0 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:44
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterBigint implements FilterInterface
{
public static function run(Column $column)
{
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterBlob.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:59
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterBlob implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type blob no require unsigned ');
}
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterChar.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:50
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterChar implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type blob no require unsigned ');
}
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterDate.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:50
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterDate implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type date no require unsigned ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterDatetime.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:49
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterDatetime implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type datetime no require unsigned ');
}
}
}

21
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterDecimal.php

@ -0,0 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:48
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterDecimal implements FilterInterface
{
public static function run(Column $column)
{
}
}

21
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterDouble.php

@ -0,0 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:48
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterDouble implements FilterInterface
{
public static function run(Column $column)
{
}
}

21
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterFloat.php

@ -0,0 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:48
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterFloat implements FilterInterface
{
public static function run(Column $column)
{
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterInt.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:44
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterInt implements FilterInterface
{
public static function run(Column $column)
{
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterLongblob.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 17:01
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterLongblob implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type longblob no require unsigned ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterLongtext.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:58
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterLongtext implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type longtext no require unsigned ');
}
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterMediumblob.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 17:00
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterMediumblob implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type mediumblob no require unsigned ');
}
}
}

21
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterMediumint.php

@ -0,0 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:45
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterMediumint implements FilterInterface
{
public static function run(Column $column)
{
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterMediumtext.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:57
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterMediumtext implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type mediumtext no require unsigned ');
}
}
}

22
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterSmallint.php

@ -0,0 +1,22 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:46
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterSmallint implements FilterInterface
{
public static function run(Column $column)
{
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterText.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:56
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterText implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type text no require unsigned ');
}
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTime.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:50
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTime implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type time no require unsigned ');
}
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTimestamp.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:49
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTimestamp implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type timestamp no require unsigned ');
}
}
}

24
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTinyblob.php

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:59
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTinyblob implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type tinyblob no require unsigned ');
}
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTinyint.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 14:47
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTinyint implements FilterInterface
{
public static function run(Column $column)
{
}
}

23
extend/mysql_dll/easyswoole/ddl/src/Filter/Unsigned/FilterTinytext.php

@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: xcg
* Date: 2019/10/16
* Time: 16:57
*/
namespace EasySwoole\DDL\Filter\Unsigned;
use EasySwoole\DDL\Blueprint\Column;
use EasySwoole\DDL\Contracts\FilterInterface;
class FilterTinytext implements FilterInterface
{
public static function run(Column $column)
{
if ($column->getUnsigned()) {
throw new \InvalidArgumentException('col ' . $column->getColumnName() . ' type tinytext no require unsigned ');
}
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save