oraeventstore

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2017 License: Apache-2.0 Imports: 5 Imported by: 2

README

Go Lang Set Up

CircleCI

Note that the settings in pkgconfig/oci8.pc need to be correct or the go get of the go-oci8 package will fail.

export PKG_CONFIG_PATH=$GOPATH/src/github.com/xtraclabs/oraeventstore/pkgconfig/
go get github.com/rjeczalik/pkgconfig/cmd/pkg-config
go get -u github.com/mattn/go-oci8

Database Set Up

For the database set up, we assume the availability of a database user who can create schema objects.

To install the schema, use flyway to install the schema. Installation involves downloading the schema and dropping the oracle JDBC jar into the flyway drivers directory.

Edit the flyway.conf in the db directory with your particulars, then from the db directory run:

flyway -user=esdbo -password=password -locations=filesystem:migration migrate

A Note on the Publish Table

The publish table simply writes the aggregate IDs of recently stored aggregates, which picks up creation and updates. Another process will need to read from the table to pick up the published aggregate, read the actual data from the event store table, do something with it (publish it to a queue, write out CQRS query views, etc), then delete the record from the publish table.

Dependencies

go get github.com/xtracdev/goes
go get github.com/Sirupsen/logrus
go get github.com/gucumber/gucumber
go get github.com/stretchr/testify/assert

Contributing

To contribute, you must certify you agree with the Developer Certificate of Origin by signing your commits via git -s. To create a signature, configure your user name and email address in git. Sign with your real name, do not use pseudonyms or submit anonymous commits.

In terms of workflow:

  1. For significant changes or improvement, create an issue before commencing work.
  2. Fork the respository, and create a branch for your edits.
  3. Add tests that cover your changes, unit tests for smaller changes, acceptance test for more significant functionality.
  4. Run gofmt on each file you change before committing your changes.
  5. Run golint on each file you change before committing your changes.
  6. Make sure all the tests pass before committing your changes.
  7. Commit your changes and issue a pull request.

License

(c) 2016 Fidelity Investments Licensed under the Apache License, Version 2.0

Documentation

Index

Constants

View Source
const (
	EventPublishEnvVar = "ES_PUBLISH_EVENTS"
)

Variables

View Source
var (
	ErrConcurrency = errors.New("Concurrency Exception")
	ErrPayloadType = errors.New("Only payloads of type []byte are allowed")
	ErrEventInsert = errors.New("Error inserting record into events table")
	ErrPubInsert   = errors.New("Error inserting record into pub table")
)

Functions

func InsertEventFromParts

func InsertEventFromParts(db *sql.DB, aggId string, version int, typecode string, payload []byte) error

Types

type OraEventStore

type OraEventStore struct {
	// contains filtered or unexported fields
}

func NewOraEventStore

func NewOraEventStore(db *sql.DB) (*OraEventStore, error)

func (*OraEventStore) GetMaxVersionForAggregate

func (ora *OraEventStore) GetMaxVersionForAggregate(aggId string) (*int, error)

func (*OraEventStore) RetrieveEvents

func (ora *OraEventStore) RetrieveEvents(aggID string) ([]goes.Event, error)

func (*OraEventStore) StoreEvents

func (ora *OraEventStore) StoreEvents(agg *goes.Aggregate) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL