承接 wwwision/projection-playground 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

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-core package 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 via composer 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.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: CSS

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固