db

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package db is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnectionClosed = errors.New("esp: postgreSQL database connections are closed")
	ErrUpdateVersion    = errors.New("esp: failed to update version")
)
View Source
var ErrInvalidEventFormat = errors.New("esp: invalid event format")

Functions

This section is empty.

Types

type DB

type DB interface {
	WalkUnpublishedEvents(ctx context.Context, fn UnpublishedAggregateFunc) error
	UpdateVersion(ctx context.Context, aggregateID string, aggregateType string, version int) (err error)
	OnEvent(eventFunc EventFunc)
	Connect(ctx context.Context, fn func() error) error
	Close() error
}

func New

func New(pool *pgxpool.Pool) DB

type ErrorFunc

type ErrorFunc func(context.Context, error)

type Event

type Event struct {
	AggregateID   string
	AggregateType string
	EventType     string
	Version       int
	Serialized    []byte
}

type EventFunc

type EventFunc func(context.Context, *Event) error

type Hook

type Hook func(context.Context) error

type MockDB

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

MockDB is a mock of DB interface

func NewMockDB

func NewMockDB(ctrl *gomock.Controller) *MockDB

NewMockDB creates a new mock instance

func (*MockDB) Close

func (m *MockDB) Close() error

Close mocks base method

func (*MockDB) Connect

func (m *MockDB) Connect(ctx context.Context, fn func() error) error

Connect mocks base method

func (*MockDB) EXPECT

func (m *MockDB) EXPECT() *MockDBMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDB) OnEvent

func (m *MockDB) OnEvent(eventFunc EventFunc)

OnEvent mocks base method

func (*MockDB) UpdateVersion

func (m *MockDB) UpdateVersion(ctx context.Context, aggregateID, aggregateType string, version int) error

UpdateVersion mocks base method

func (*MockDB) WalkUnpublishedEvents

func (m *MockDB) WalkUnpublishedEvents(ctx context.Context, fn UnpublishedAggregateFunc) error

WalkUnpublishedEvents mocks base method

type MockDBMockRecorder

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

MockDBMockRecorder is the mock recorder for MockDB

func (*MockDBMockRecorder) Close

func (mr *MockDBMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockDBMockRecorder) Connect

func (mr *MockDBMockRecorder) Connect(ctx, fn interface{}) *gomock.Call

Connect indicates an expected call of Connect

func (*MockDBMockRecorder) OnEvent

func (mr *MockDBMockRecorder) OnEvent(eventFunc interface{}) *gomock.Call

OnEvent indicates an expected call of OnEvent

func (*MockDBMockRecorder) UpdateVersion

func (mr *MockDBMockRecorder) UpdateVersion(ctx, aggregateID, aggregateType, version interface{}) *gomock.Call

UpdateVersion indicates an expected call of UpdateVersion

func (*MockDBMockRecorder) WalkUnpublishedEvents

func (mr *MockDBMockRecorder) WalkUnpublishedEvents(ctx, fn interface{}) *gomock.Call

WalkUnpublishedEvents indicates an expected call of WalkUnpublishedEvents

type UnpublishedAggregate

type UnpublishedAggregate struct {
	AggregateID            string
	AggregateType          string
	LatestPublishedVersion int
	CurrentVersion         int
	Events                 []*Event
}

func (UnpublishedAggregate) TotalUnpublished

func (ua UnpublishedAggregate) TotalUnpublished() int

type UnpublishedAggregateFunc

type UnpublishedAggregateFunc func(ctx context.Context, aggregate *UnpublishedAggregate) error

Jump to

Keyboard shortcuts

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