EventStore-Client-Go

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: Apache-2.0

README

EventStoreDB gRPC Client written in Golang Actions Status

This is a fork of the EventStore's Golang Client for EventStoreDB

Supported EventstoreDB gRPC API version

Supports Eventstore gRPC API 21.6.0

How To Install

$ go get github.com/pivonroll/EventStore-Client-Go

Supported Features

  • Event Streams
    • Append Events One by One
    • Batch Append Events
    • Tombstone (hard delete)
    • Delete (soft delete)
    • Get/Set Stream Metadata
    • Read Stream Events
    • Read All Events
    • Subscribe To Stream
    • Subscribe To All
  • Persistent Subscriptions
    • Create/Update/Delete
    • Subscribe To Persistent Subscription
  • Projections
    • Create/Update/Delete Projections
    • Enable/Abort/Disable/Reset Projection
    • Get Projection's State/Result/Statistics
    • Restart Projection Subsystem
    • List All/Continuous/One Time Projections
  • User Management
    • Create/Update/Delete User
    • Enable/Disable User
    • Get User's Details
    • List All Users
    • Change User's Password
    • Reset Users Password
  • Operations
    • Merge Indexes
    • Resign Node
    • Restart Persistent Subscriptions
    • Scavenging (Start/Stop)
    • Set Node Priority
    • Shutdown

Developing

Integration tests run against a server using Docker, with the EventStoreDB gRPC Client Test Container. New releases are published on github.com/pivonroll/EventStore-Client-Go. To run integration tests you need to have Docker installed and running.

Starting docker in most Linux distros is done through systemctl. For example:

$ sudo systemctl start docker.service

If your Linux distro does not use systemctl, check what it uses and how to start docker on it.

Setup dependencies

Some dependencies are required in order to work with the code

1. Generate GRPC Client from proto

In order to generate Golang GRPC Client code from proto, run:

Windows

.\build.ps1 -generateProtos

Unix (Linux or OSX)

./build.sh --generate-protos

2. Generate certificates for testing TLS requirements

To generate certificates for TLS you need to run (from projects main directory)

$ sudo docker-compose up

The docker container will generate TLS certificates and put them in ./certs directory.


3. Fetch EventstoreDB container with available pre-populated database

To access the docker images in GitHub Packages, you need to authenticate docker with a gitub personal access token. It should be generated with at least the following scopes:

  • repo
  • read:packages

Then login to the github docker registry with:

$ sudo docker login https://docker.pkg.github.com -u YOUR_GITHUB_USERNAME

or

$ sudo docker login ghcr.io  -u YOUR_GITHUB_USERNAME

and provide your personal access token as a password.

Alternatively you can store your access token in a file (example: ~/.accesstoken) and login by executing:

$ cat ~/.accesstoken | docker login ghcr.io -u USERNAME --password-stdin

The full instructions can be found in the "Authenticating to GitHub packages" guide.

Pull the required docker image (should be 21.6.0):

$ sudo docker pull docker.pkg.github.com/eventstore/eventstore-client-grpc-testdata/eventstore-client-grpc-testdata:21.6.0-buster-slim

Build the project

On Windows, you need Powershell. The version that comes standard with Windows is enough. On a Unix system, any bash compatible shell should work.

Windows
.\build.ps1
Unix (Linux or OSX)
./build.sh

Run tests

go test ./client

Contributing

All contributions to the SDK are made via GitHub Pull Requests, and must be licensed under the Apache 2.0 license.

Directories

Path Synopsis
core
buffered_async
Package buffered_async is a generated GoMock package.
Package buffered_async is a generated GoMock package.
connection
Package connection is a generated GoMock package.
Package connection is a generated GoMock package.
ptr
Package event_streams provides interaction with EventStoreDb event streams.
Package event_streams provides interaction with EventStoreDb event streams.
integration_tests
Package operations provides interaction with EventStoreDb admin operations.
Package operations provides interaction with EventStoreDb admin operations.
internal/grpc_operations_client
Package grpc_operations_client is a generated GoMock package.
Package grpc_operations_client is a generated GoMock package.
Package persistent provides a set of available interactions with persistent subscription groups in EventStoreDB.
Package persistent provides a set of available interactions with persistent subscription groups in EventStoreDB.
internal/event_reader_mock
Package event_reader_mock is a generated GoMock package.
Package event_reader_mock is a generated GoMock package.
internal/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package projections provides interaction with projections in EventStoreDB.
Package projections provides interaction with projections in EventStoreDB.
internal/grpc_proto_client_factory
Package grpc_proto_client_factory is a generated GoMock package.
Package grpc_proto_client_factory is a generated GoMock package.
internal/statistics
Package statistics is a generated GoMock package.
Package statistics is a generated GoMock package.
protos
persistent
Package persistent is a generated GoMock package.
Package persistent is a generated GoMock package.
projections
Package projections is a generated GoMock package.
Package projections is a generated GoMock package.
Package user_management provides user management capabilities for EventStoreDb.
Package user_management provides user management capabilities for EventStoreDb.

Jump to

Keyboard shortcuts

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