level51 / cqrs-utils
SilverStripe 的多数据存储 CQRS 工具
dev-develop
2017-11-08 00:00 UTC
Requires
- php: >=7
- silverstripe/framework: ~3.6
- unclecheese/betterbuttons: ~1.3.14
Suggests
- ext-mongodb: Required for use with the MongoPayloadStoreHandler
- ext-redis: Required for use with the RedisPayloadStoreHandler
- elasticsearch/elasticsearch: Required for use with the ElasticsearchPayloadStoreHandler
- mongodb/mongodb: Required for use with the MongoPayloadStoreHandler
This package is auto-updated.
Last update: 2024-09-22 13:10:21 UTC
README
实现 SilverStripe 应用中 CQRS 工作流程的实用模块。
⚠️ 这是一个正在进行中的项目,目前还不能使用或进行试验!我们正在项目中测试这个项目,一旦达到足够的增值,我们将提供稳定的构建版本。
读取有效载荷清单
读取有效载荷清单定义了基于类存储的数据。
示例清单(《$read_payload》)
class MyObject extends DataObject { private static $db = [ 'Title' => 'Varchar', 'Teaser => 'Text', 'Content => 'HTMLText' ]; private static $has_many = [ 'Categories' => Category::class ]; private static $read_payload = [ 'ID', // required 'Title' => 'CoolTitle' // required, maps to "CoolTitle()" 'Teaser' => false, // not required 'Content' => true, // required (non-shorthand) 'Author', // required (method value) 'Categories' => true, // required recursive relation table 'Tags' => [ // not required, maps to "getMyTags()" 'required' => false, 'mapping' => 'getMyTags' ] ]; public function CoolTitle() { ... } public function Author() { ... } public function getMyTags() { ... } }
处理器
Redis
附加要求
- ext-redis: PHP Redis 扩展
示例配置
CustomDataObject: extensions: - CQRSExtension('ID', ['store' => 'RedisPayloadStoreHandler', 'db' => 1]) # Optional, defaults to the values below RedisPayloadStoreHandler: host: 127.0.0.1 port: 6379 default_db: 0
MongoDB
附加要求
- ext-mongodb: PHP MongoDB 扩展
- mongodb/mongodb: MongoDB PHP 库
示例配置
CustomDataObject: extensions: - CQRSExtension('ID', ['store' => 'MongoPayloadStoreHandler', 'db' => 'DB_NAME', 'collection' => 'COLLECTION_NAME']) # Optional, defaults to the values below MongoPayloadStoreHandler: host: 127.0.0.1 port: 27017
Elasticsearch
附加要求
- elasticsearch/elasticsearch: Elasticsearch PHP 客户端
示例配置
CustomDataObject: extensions: - CQRSExtension('ID', ['store' => 'ElasticsearchPayloadStoreHandler', 'index' => 'INDEX_NAME']) # Optional, defaults to localhost:9200 ElasticsearchPayloadStoreHandler: hosts: - localhost:9200 - { host: elastic.domain.tld, port: 443, scheme: https, user: USERNAME, pass: PASS }
维护者
- Julian Scheuchenzuber js@lvl51.de