projections

package
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 Imports: 13 Imported by: 0

Documentation

Overview

Package projections provides interaction with projections in EventStoreDB. Before accessing streams a grpc connection needs to be established with EventStore through github.com/pivonroll/EventStore-Client-Go/core/connection package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolResult added in v0.11.0

type BoolResult bool

BoolResult represents a boolean value.

func (BoolResult) ResultType added in v0.11.0

func (s BoolResult) ResultType() ResultType

ResultType returns ResultTypeBool.

type Client

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

Client which can interact with EventStoreDB projections.

func NewClient added in v0.11.0

func NewClient(
	grpcClient connection.GrpcClient) *Client

NewClient creates a new client instance. Grpc connection must be passed to the new client instance.

func (*Client) AbortProjection

func (client *Client) AbortProjection(
	ctx context.Context,
	projectionName string) errors.Error

AbortProjection aborts an existing projection.

func (*Client) CreateProjection

func (client *Client) CreateProjection(
	ctx context.Context,
	options CreateRequest) errors.Error

CreateProjection creates a new projection on EventStoreDB.

func (*Client) DeleteProjection

func (client *Client) DeleteProjection(
	ctx context.Context,
	options DeleteRequest) errors.Error

DeleteProjection removes a projection from EventStoreDB.

func (*Client) DisableProjection

func (client *Client) DisableProjection(
	ctx context.Context,
	projectionName string) errors.Error

DisableProjection disables an existing projection.

func (*Client) EnableProjection

func (client *Client) EnableProjection(
	ctx context.Context,
	projectionName string) errors.Error

EnableProjection enables a disabled projection. If projection was already enabled it does noop (no operation).

func (*Client) GetProjectionResult

func (client *Client) GetProjectionResult(
	ctx context.Context,
	options ResultRequest) (IsResult, errors.Error)

GetProjectionResult fetches a result of a projection.

func (*Client) GetProjectionState

func (client *Client) GetProjectionState(
	ctx context.Context,
	options StateRequest) (IsResult, errors.Error)

GetProjectionState fetches a state of the projection.

func (*Client) GetProjectionStatistics

func (client *Client) GetProjectionStatistics(
	ctx context.Context,
	mode IsStatisticsProjection) (statistics.Reader, errors.Error)

GetProjectionStatistics returns a reader for projection's statistics.

func (*Client) ListAllProjections

func (client *Client) ListAllProjections(
	ctx context.Context) ([]statistics.Response, errors.Error)

ListAllProjections lists details of all projections.

func (*Client) ListContinuousProjections

func (client *Client) ListContinuousProjections(
	ctx context.Context) ([]statistics.Response, errors.Error)

ListContinuousProjections lists details of all continuous projections.

func (*Client) ListOneTimeProjections

func (client *Client) ListOneTimeProjections(
	ctx context.Context) ([]statistics.Response, errors.Error)

ListOneTimeProjections lists details of all one-time projections.

func (*Client) ResetProjection

func (client *Client) ResetProjection(
	ctx context.Context,
	options ResetRequest) errors.Error

ResetProjection resets an existing projection.

func (*Client) RestartProjectionsSubsystem

func (client *Client) RestartProjectionsSubsystem(ctx context.Context) errors.Error

RestartProjectionsSubsystem restarts a projection subsystem at EventStoreDB.

func (*Client) UpdateProjection

func (client *Client) UpdateProjection(
	ctx context.Context,
	options UpdateRequest) errors.Error

UpdateProjection updates an existing projection on EventStoreDB.

type ContinuousProjection added in v0.11.0

type ContinuousProjection struct {
	ProjectionName      string
	TrackEmittedStreams bool
}

ContinuousProjection mode is used to create a continuous projection.

func (ContinuousProjection) GetType added in v0.11.0

func (mode ContinuousProjection) GetType() ProjectionType

GetType returns a mode type. In this case it will be ContinuousProjectionsType. See constant ContinuousProjectionsType.

type CreateRequest added in v0.11.0

type CreateRequest struct {
	Mode  isProjectionType
	Query string
}

CreateRequest represents data required to create a projection at EventStoreDB.

type DeleteRequest added in v0.11.0

type DeleteRequest struct {
	ProjectionName         string
	DeleteEmittedStreams   bool
	DeleteStateStream      bool
	DeleteCheckpointStream bool
}

DeleteRequest contains projection's name and a set of options what to do with emit, state and checkpoint stream.

type EmitEnabled added in v0.11.0

type EmitEnabled struct {
	EmitEnabled bool
}

EmitEnabled setting determines whether a projection can emit events and any projection that calls emit() or linkTo() requires it. Read more at https://developers.eventstore.com/server/v21.6/projections/projections-config.html#emit-enabled

type Float64Result added in v0.11.0

type Float64Result float64

Float64Result represents a float64 value.

func (Float64Result) ResultType added in v0.11.0

func (s Float64Result) ResultType() ResultType

ResultType returns ResultTypeFloat64.

type IsResult added in v0.11.0

type IsResult interface {
	// ResultType returns a type of the value.
	ResultType() ResultType
}

IsResult an interface of the result value.

type IsStatisticsProjection added in v0.11.0

type IsStatisticsProjection interface {
	// contains filtered or unexported methods
}

IsStatisticsProjection is general interface type which is used to represent all statistics modes through which we can select to fetch statistics of specific projections.

type JSONBytes

type JSONBytes []byte

JSONBytes is an alias for slice of bytes.

type JSONObjectListResult added in v0.11.0

type JSONObjectListResult []JSONBytes

JSONObjectListResult represents a slice of JSON objects.

func (JSONObjectListResult) ResultType added in v0.11.0

func (s JSONObjectListResult) ResultType() ResultType

ResultType returns ResultTypeJSONObjectList.

type JSONObjectResult added in v0.11.0

type JSONObjectResult JSONBytes

JSONObjectResult represents a JSON object.

func (JSONObjectResult) ResultType added in v0.11.0

func (s JSONObjectResult) ResultType() ResultType

ResultType returns ResultTypeJSONObject.

type NoEmit added in v0.11.0

type NoEmit struct{}

NoEmit should be used to remove emit set from a projection.

type NullResult added in v0.11.0

type NullResult struct{}

NullResult represents a null.

func (NullResult) ResultType added in v0.11.0

func (s NullResult) ResultType() ResultType

ResultType returns ResultTypeNull.

type OneTimeProjection added in v0.11.0

type OneTimeProjection struct{}

OneTimeProjection mode instructs EventStoreDB to create one-time projection.

func (OneTimeProjection) GetType added in v0.11.0

func (mode OneTimeProjection) GetType() ProjectionType

GetType returns a mode type. In this case it will be OneTimeProjectionType. See constant OneTimeProjectionType.

type ProjectionType added in v0.11.0

type ProjectionType string
const (
	OneTimeProjectionType     ProjectionType = "OneTimeProjectionType"
	TransientProjectionType   ProjectionType = "TransientProjectionType"
	ContinuousProjectionsType ProjectionType = "ContinuousProjectionsType"
)

type ResetRequest added in v0.11.0

type ResetRequest struct {
	ProjectionName  string
	WriteCheckpoint bool
}

ResetRequest contains projection's name and whether to write a checkpoint or not when projection is reset.

type ResultRequest added in v0.11.0

type ResultRequest struct {
	ProjectionName string
	Partition      string
}

ResultRequest represents input required to fetch a result of a projection.

type ResultType added in v0.11.0

type ResultType string

ResultType is a type of the result received by reading a result of a projection of projection's state.

const (
	// ResultTypeNull received value is null.
	ResultTypeNull ResultType = "ResultTypeNull"
	// ResultTypeFloat64 received value is a float64 type.
	ResultTypeFloat64 ResultType = "ResultTypeFloat64"
	// ResultTypeString received value is a string type.
	ResultTypeString ResultType = "ResultTypeString"
	// ResultTypeBool received value is a bool type.
	ResultTypeBool ResultType = "ResultTypeBool"
	// ResultTypeJSONObject received value is a JSON object type.
	ResultTypeJSONObject ResultType = "ResultTypeJSONObject"
	// ResultTypeJSONObjectList received value is a slice of JSON objects.
	ResultTypeJSONObjectList ResultType = "ResultTypeJSONObjectList"
)

type StateRequest added in v0.11.0

type StateRequest struct {
	ProjectionName string
	Partition      string
}

StateRequest represents input required to fetch state of the projection.

type StatisticsForAllProjections added in v0.11.0

type StatisticsForAllProjections struct{}

StatisticsForAllProjections fetch statistics for all projections.

type StatisticsForContinuousProjections added in v0.11.0

type StatisticsForContinuousProjections struct{}

StatisticsForContinuousProjections fetch statistics for all continuous projections.

type StatisticsForOneTimeProjections added in v0.11.0

type StatisticsForOneTimeProjections struct{}

StatisticsForOneTimeProjections fetch statistics for all one-time projections.

type StatisticsForProjectionByName added in v0.11.0

type StatisticsForProjectionByName struct {
	ProjectionName string
}

StatisticsForProjectionByName fetch statistics for a specific projection.

type StatisticsForTransientProjections added in v0.11.0

type StatisticsForTransientProjections struct{}

StatisticsForTransientProjections fetch statistics for all transient projections.

type StringResult added in v0.11.0

type StringResult string

StringResult represents a string value.

func (StringResult) ResultType added in v0.11.0

func (s StringResult) ResultType() ResultType

ResultType returns ResultTypeString.

type TransientProjection added in v0.11.0

type TransientProjection struct {
	ProjectionName string
}

TransientProjection mode is used to create transient projection.

func (TransientProjection) GetType added in v0.11.0

func (mode TransientProjection) GetType() ProjectionType

GetType returns a mode type. In this case it will be TransientProjectionType. See constant TransientProjectionType.

type UpdateRequest added in v0.11.0

type UpdateRequest struct {
	EmitOption     isEmit
	Query          string
	ProjectionName string
}

UpdateRequest represents a set of options which we want to update for a specific projection. Projection is referenced by name.

Directories

Path Synopsis
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.
statistics
Package statistics is a generated GoMock package.
Package statistics is a generated GoMock package.

Jump to

Keyboard shortcuts

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