定制 psmb/mapreduce 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

psmb/mapreduce

Composer 安装命令:

composer require psmb/mapreduce

包简介

Map/Reduce FlowQuery operations

README 文档

README

This package provides .map() and .reduce() FlowQuery operations. Could be useful, huh?

Installation

composer require 'psmb/mapreduce:@dev'

Usage

Map

Takes all items in current FlowQuery context, and transforms each value with given Eel operation. There is a context variable value available, with a value of a current node.

E.g. this would give you an array of identifiers of all child nodes of a given node:

${q(node).children().map('value.identifier')}

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map

Reduce

Takes an Eel Expression as a first argument and initial values as the second. Injects previousValue, currentValue, index and array context variables.

E.g. imagine you have a collection of Order nodes, where each node has a price property. Now let's try to get a total price for all of the give nodes:

${q(node).children('orders').reduce('previousValue + currentValue.properties.price', 0)

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce

统计信息

  • 总下载量: 1.39k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2016-10-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固