wwwision/projection-playground
Composer 安装命令:
composer require wwwision/projection-playground
包简介
Neos backend module that allows for creating and testing ESCR projections on the fly
README 文档
README
Neos backend module that allows for creating and testing ESCR projections on the fly
Usage
install via composer:
composer require wwwision/projection-playground
Note At the time of writing, the
neos/contentrepository-corepackage is not yet available on packagist You can download it from GitHub to your distribution folder: https://github.com/neos/neos-development-collection/tree/9.0/Neos.ContentRepository.Core and install everything viacomposer require wwwision/projection-playground neos/contentrepository-core:@dev
Afterwards, if you log into the Neos Backend as an Administrator, you can navigate to the new backend module at /neos/administration/projection-playground and start playing.
Projections
The projection logic can be written in JavaScript. This package supports a subset of the EventStoreDB projection syntax (see Documentation)
Example projections
Count all events
fromAll() .when({ $init: () => ({count: 0}), $any: (s, e) => { s.count ++; } })
Count created node types
...and transform the result to order them by most used type
fromAll() .when({ NodeAggregateWithNodeWasCreated: (s, e) => { const nodeType = e.body.nodeTypeName; s[nodeType] = (s[nodeType] ?? 0) + 1; } }).transformBy(s => Object.fromEntries(Object.entries(s).sort((a, b) => b[1] - a[1])))
Aggregate events by their weekday
...and transform the result to order them by most popular day
fromAll() .when({ $any: (s, e) => { const timestamp = e.metadataRaw['initiatingTimestamp']; if (!timestamp) { return; } const date = new Date(timestamp); const weekDay = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][date.getDay()]; s[weekDay] = (s[weekDay] ?? 0) + 1; } }).transformBy(s => Object.fromEntries(Object.entries(s).sort((a, b) => b[1] - a[1])))
Disclaimer
This project is not endorsed by Event Store Ltd.
wwwision/projection-playground 适用场景与选型建议
wwwision/projection-playground 是一款 基于 CSS 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 04 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wwwision/projection-playground 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wwwision/projection-playground 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-26