Giter Site home page Giter Site logo

go.cqrs's Introduction

Go.CQRS license Go Report Card GoDoc

A Golang CQRS Reference implementation

Go.CQRS provides interfaces and implementations to support a CQRS implementation in Golang. The examples directory contains a sample application that demonstrates how to use Go.CQRS.

As much as possible Go.CQRS has been designed with the principles of CQRS espoused by Greg Young which represents the best thinking on the topic.

CQRS Pattern vs CQRS Framework

CQRS is an architectural pattern. When implementing the CQRS pattern, it is easy to imagine how the code could be packaged into a framework. However, it is recommended that those working with CQRS focus on learning the underlying detail of the pattern rather than simply use a framework.

The implementation of the CQRS pattern is not especially difficult, however it is a steep learning curve because the pattern is very different to the traditional non CQRS architecture. Topics such as Aggregate Design are very different. If you are going to use EventSourcing and eventual consistency then there is a lot of learning to be done.

If you are new to CQRS or simply interested in best practices there is a great 6 hour video of a hands-on CQRS workshop by Greg Young.

Once the pattern is understood, implementations such as Go.CQRS can be used as a reference for learning how to implement the pattern in Golang and also as a foundation upon which to build your CQRS implementation.

What does Go.CQRS provide?

Feature Description
Aggregate AggregateRoot interface and Aggregate base type that can be embedded in your own types to provide common functions required by aggregates
Event An Event interface and an EventDescriptor which is a message envelope for events. Events in Go.CQRS are simply plain Go structs and there are no magic strings to describe them as is the case in some other Go implementations.
Command A Command interface and an CommandDescriptor which is a message envelope for commands. Commands in Go.CQRS are simply plain Go structs and there are no magic strings to describe them as is the case in some other Go implementations.
CommandHandler Interface and base functionality for chaining command handlers
Dispatcher Dispatcher interface and an in memory dispatcher implementation
EventBus EventBus interface and in memory implementation
EventHandler EventHandler interface
Repository Repository interface and an implementation of the CommonDomain repository that persists events in GetEventStore. While there are many generic event store implementations over common databases such as MongoDB, GetEventStore is a specialised EventSourcing database that is open source, performant and reflects the best thinking on the topic from a highly experienced team in this field.
StreamNamer A StreamNamer interface and a DelegateStreamNamer implementation that supports the use of functions with the signiature func(string, string) string to provide flexibility around stream naming. A common way to construct a stream name might be to use the name of your BoundedContext suffixed with an AggregateID.

All implementations are easily replaced to suit your particular requirements.

Example code

The examples folder contains a simple and clear example of how to use go.cqrs to contruct your service. The example is a port of the classic reference implementation m-r by Greg Young.

Getting Started

    $ go get github.com/jetbasrawi/go.cqrs

Refer to the example application for guidance on how to use Go.CQRS.

go.cqrs's People

Contributors

jetbasrawi avatar lansana avatar tugberkugurlu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.