新增
This commit is contained in:
+71
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2023 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace think\contract;
|
||||
|
||||
use DateInterval;
|
||||
use DateTimeInterface;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use think\cache\TagSet;
|
||||
|
||||
/**
|
||||
* 缓存驱动接口
|
||||
*/
|
||||
interface CacheHandlerInterface extends CacheInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* 自增缓存(针对数值缓存)
|
||||
* @param string $name 缓存变量名
|
||||
* @param int $step 步长
|
||||
* @return false|int
|
||||
*/
|
||||
public function inc($name, $step = 1);
|
||||
|
||||
/**
|
||||
* 自减缓存(针对数值缓存)
|
||||
* @param string $name 缓存变量名
|
||||
* @param int $step 步长
|
||||
* @return false|int
|
||||
*/
|
||||
public function dec($name, $step = 1);
|
||||
|
||||
/**
|
||||
* 读取缓存并删除
|
||||
* @param string $name 缓存变量名
|
||||
* @return mixed
|
||||
*/
|
||||
public function pull($name);
|
||||
|
||||
/**
|
||||
* 如果不存在则写入缓存
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param int|DateInterval|DateTimeInterface $expire 有效时间 0为永久
|
||||
* @return mixed
|
||||
*/
|
||||
public function remember($name, $value, $expire = null);
|
||||
|
||||
/**
|
||||
* 缓存标签
|
||||
* @param string|array $name 标签名
|
||||
* @return TagSet
|
||||
*/
|
||||
public function tag($name);
|
||||
|
||||
/**
|
||||
* 删除缓存标签
|
||||
* @param array $keys 缓存标识列表
|
||||
* @return void
|
||||
*/
|
||||
public function clearTag($keys);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace think\contract;
|
||||
|
||||
/**
|
||||
* 日志驱动接口
|
||||
*/
|
||||
interface LogHandlerInterface
|
||||
{
|
||||
/**
|
||||
* 日志写入接口
|
||||
* @access public
|
||||
* @param array $log 日志信息
|
||||
* @return bool
|
||||
*/
|
||||
public function save(array $log): bool;
|
||||
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2023 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace think\contract;
|
||||
|
||||
use Closure;
|
||||
use think\db\BaseQuery as Query;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 模型关联接口
|
||||
*/
|
||||
interface ModelRelationInterface
|
||||
{
|
||||
/**
|
||||
* 延迟获取关联数据
|
||||
* @access public
|
||||
* @param array $subRelation 子关联
|
||||
* @param Closure $closure 闭包查询条件
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRelation(array $subRelation = [], Closure $closure = null);
|
||||
|
||||
/**
|
||||
* 预载入关联查询
|
||||
* @access public
|
||||
* @param array $resultSet 数据集
|
||||
* @param string $relation 当前关联名
|
||||
* @param array $subRelation 子关联名
|
||||
* @param Closure $closure 闭包条件
|
||||
* @return void
|
||||
*/
|
||||
public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation, Closure $closure = null): void;
|
||||
|
||||
/**
|
||||
* 预载入关联查询
|
||||
* @access public
|
||||
* @param Model $result 数据对象
|
||||
* @param string $relation 当前关联名
|
||||
* @param array $subRelation 子关联名
|
||||
* @param Closure $closure 闭包条件
|
||||
* @return void
|
||||
*/
|
||||
public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null): void;
|
||||
|
||||
/**
|
||||
* 关联统计
|
||||
* @access public
|
||||
* @param Model $result 模型对象
|
||||
* @param Closure $closure 闭包
|
||||
* @param string $aggregate 聚合查询方法
|
||||
* @param string $field 字段
|
||||
* @param string $name 统计字段别名
|
||||
* @return integer
|
||||
*/
|
||||
public function relationCount(Model $result, Closure $closure, string $aggregate = 'count', string $field = '*', string &$name = null);
|
||||
|
||||
/**
|
||||
* 创建关联统计子查询
|
||||
* @access public
|
||||
* @param Closure $closure 闭包
|
||||
* @param string $aggregate 聚合查询方法
|
||||
* @param string $field 字段
|
||||
* @param string $name 统计字段别名
|
||||
* @return string
|
||||
*/
|
||||
public function getRelationCountQuery(Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null): string;
|
||||
|
||||
/**
|
||||
* 根据关联条件查询当前模型
|
||||
* @access public
|
||||
* @param string $operator 比较操作符
|
||||
* @param integer $count 个数
|
||||
* @param string $id 关联表的统计字段
|
||||
* @param string $joinType JOIN类型
|
||||
* @return Query
|
||||
*/
|
||||
public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = 'INNER', Query $query = null): Query;
|
||||
|
||||
/**
|
||||
* 根据关联条件查询当前模型
|
||||
* @access public
|
||||
* @param mixed $where 查询条件(数组或者闭包)
|
||||
* @param mixed $fields 字段
|
||||
* @param string $joinType JOIN类型
|
||||
* @return Query
|
||||
*/
|
||||
public function hasWhere($where = [], $fields = null, string $joinType = ''): Query;
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2023 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace think\contract;
|
||||
|
||||
/**
|
||||
* Session驱动接口
|
||||
*/
|
||||
interface SessionHandlerInterface
|
||||
{
|
||||
public function read(string $sessionId): string;
|
||||
public function delete(string $sessionId): bool;
|
||||
public function write(string $sessionId, string $data): bool;
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2023 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace think\contract;
|
||||
|
||||
/**
|
||||
* 视图驱动接口
|
||||
*/
|
||||
interface TemplateHandlerInterface
|
||||
{
|
||||
/**
|
||||
* 检测是否存在模板文件
|
||||
* @access public
|
||||
* @param string $template 模板文件或者模板规则
|
||||
* @return bool
|
||||
*/
|
||||
public function exists(string $template): bool;
|
||||
|
||||
/**
|
||||
* 渲染模板文件
|
||||
* @access public
|
||||
* @param string $template 模板文件
|
||||
* @param array $data 模板变量
|
||||
* @return void
|
||||
*/
|
||||
public function fetch(string $template, array $data = []): void;
|
||||
|
||||
/**
|
||||
* 渲染模板内容
|
||||
* @access public
|
||||
* @param string $content 模板内容
|
||||
* @param array $data 模板变量
|
||||
* @return void
|
||||
*/
|
||||
public function display(string $content, array $data = []): void;
|
||||
|
||||
/**
|
||||
* 配置模板引擎
|
||||
* @access private
|
||||
* @param array $config 参数
|
||||
* @return void
|
||||
*/
|
||||
public function config(array $config): void;
|
||||
|
||||
/**
|
||||
* 获取模板引擎配置
|
||||
* @access public
|
||||
* @param string $name 参数名
|
||||
* @return void
|
||||
*/
|
||||
public function getConfig(string $name);
|
||||
}
|
||||
Reference in New Issue
Block a user