update EntityParseInterface
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Model\Company;
|
||||
use App\Model\Platform;
|
||||
use App\Model\Store;
|
||||
use App\Model\Model as Entity;
|
||||
use Hyperf\Amqp\Message\ConsumerMessageInterface;
|
||||
use Hyperf\Collection\LazyCollection;
|
||||
|
||||
/**
|
||||
@@ -72,13 +73,23 @@ interface EntityParseInterface
|
||||
public function entityMap(array $rawData): LazyCollection;
|
||||
|
||||
/**
|
||||
* 提取实体唯一标识符, 根据字段查找数据库中匹配的唯一实体
|
||||
* 获取实体的唯一键字段(用于 upsert 的 uniqueBy 参数)
|
||||
*
|
||||
* @param array $metadata
|
||||
* @return array 提供给 Model::query()->where() 作为参数使用, 每个数组元素的键值分别作为字段名和值
|
||||
* 如果需要多个字段来确认唯一性,则构造多个字段元素
|
||||
* 定义哪些字段组成唯一约束
|
||||
*
|
||||
* @return array 唯一键字段名数组
|
||||
*/
|
||||
public function entityUniqueIdentifierExtract(array $metadata): array;
|
||||
public function getUniqueBy(): array;
|
||||
|
||||
/**
|
||||
* 获取可更新的字段列表(用于 upsert 的 update 参数)
|
||||
*
|
||||
* 明确定义哪些字段在更新时可以被修改
|
||||
* 通常需要排除:主键、唯一键、创建时间、关联 ID 等不应变更的字段
|
||||
*
|
||||
* @return array 可更新字段名数组
|
||||
*/
|
||||
public function getUpdateFields(): array;
|
||||
|
||||
/**
|
||||
* 获取消息数据
|
||||
@@ -87,6 +98,13 @@ interface EntityParseInterface
|
||||
*/
|
||||
public function getData(): array;
|
||||
|
||||
/**
|
||||
* 获取消息对象
|
||||
*
|
||||
* @return ConsumerMessageInterface
|
||||
*/
|
||||
public function getMessage(): ConsumerMessageInterface;
|
||||
|
||||
/**
|
||||
* 获取平台对象
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user