feat(utils): 添加批量更新相关的一个数据转换工具函数 normBulkUpdate #532
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
在批量接口使用 PUT 请求时,后端 response 上往往不会把所有更新的对象一
一罗列,而是以
{ xxIds: Id[], ...updatedFields }
的压缩形式呈现。这样的数据是没办法直接更新到缓存层(RDB)的。
这里添加的 normBulkUpdate 函数可以用来将后端返回的这种压缩形式转换为缓
存层能接收的形式。如:
会得到
而在常见的 Observable response$ 上,则可以
更多边界条件的行为定义,请见相应测试。
/cc @coldfannn @aicest