adapters

package
v0.0.0-...-e28bd7b Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventAdapter

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

EventAdapter communicates to IncomingEventPort and implements OutgoingEventPort

func NewEventAdapter

func NewEventAdapter(conn messaging2.EventConnection) *EventAdapter

NewEventAdapter creates a new EventAdapter from EventConnection

func (*EventAdapter) CreateFailed

func (adapter *EventAdapter) CreateFailed(actor string, emulator string, userAction types.UserAction, creationError error, transactionID cacao_common.TransactionID) error

CreateFailed publishes cacao_common_service.UserActionCreateFailedEvent

func (*EventAdapter) Created

func (adapter *EventAdapter) Created(actor string, emulator string, userAction types.UserAction, transactionID cacao_common.TransactionID) error

Created publishes cacao_common_service.UserActionCreatedEvent

func (*EventAdapter) DeleteFailed

func (adapter *EventAdapter) DeleteFailed(actor string, emulator string, userAction types.UserAction, deletionError error, transactionID cacao_common.TransactionID) error

DeleteFailed publishes cacao_common_service.UserActionDeleteFailedEvent

func (*EventAdapter) Deleted

func (adapter *EventAdapter) Deleted(actor string, emulator string, userAction types.UserAction, transactionID cacao_common.TransactionID) error

Deleted publishes cacao_common_service.UserActionDeletedEvent

func (*EventAdapter) SetHandlers

func (adapter *EventAdapter) SetHandlers(handlers ports.IncomingEventHandlers)

SetHandlers ...

func (*EventAdapter) Start

func (adapter *EventAdapter) Start(ctx context.Context, wg *sync.WaitGroup) error

Start starts the adapter

func (*EventAdapter) UpdateFailed

func (adapter *EventAdapter) UpdateFailed(actor string, emulator string, userAction types.UserAction, updateError error, transactionID cacao_common.TransactionID) error

UpdateFailed publishes cacao_common_service.UserActionUpdateFailedEvent

func (*EventAdapter) Updated

func (adapter *EventAdapter) Updated(actor string, emulator string, userAction types.UserAction, transactionID cacao_common.TransactionID) error

Updated publishes cacao_common_service.UserActionUpdatedEvent.

type MongoAdapter

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

MongoAdapter implements PersistentStoragePort

func (*MongoAdapter) Close

func (adapter *MongoAdapter) Close() error

Close closes Mongo DB connection

func (*MongoAdapter) Create

func (adapter *MongoAdapter) Create(userAction types.UserAction) error

Create inserts a user action

func (*MongoAdapter) Delete

func (adapter *MongoAdapter) Delete(user string, userActionID cacao_common.ID) error

Delete deletes a user action

func (*MongoAdapter) Get

func (adapter *MongoAdapter) Get(user string, userActionID cacao_common.ID) (types.UserAction, error)

Get returns the user action with the ID

func (*MongoAdapter) GetMock

func (adapter *MongoAdapter) GetMock() *mock.Mock

GetMock returns Mock

func (*MongoAdapter) Init

func (adapter *MongoAdapter) Init(config *types.Config) error

Init initialize mongodb adapter

func (*MongoAdapter) List

func (adapter *MongoAdapter) List(user string) ([]types.UserAction, error)

List returns user actions owned by a user

func (*MongoAdapter) MockCreate

func (adapter *MongoAdapter) MockCreate(userAction types.UserAction, expectedError error) error

MockCreate sets expected results for Create

func (*MongoAdapter) MockDelete

func (adapter *MongoAdapter) MockDelete(user string, userActionID cacao_common.ID, existingUserAction types.UserAction, expectedError error) error

MockDelete sets expected results for Delete

func (*MongoAdapter) MockGet

func (adapter *MongoAdapter) MockGet(user string, userActionID cacao_common.ID, expectedUserAction types.UserAction, expectedError error) error

MockGet sets expected results for Get

func (*MongoAdapter) MockList

func (adapter *MongoAdapter) MockList(user string, expectedUserActions []types.UserAction, expectedError error) error

MockList sets expected results for List

func (*MongoAdapter) MockUpdate

func (adapter *MongoAdapter) MockUpdate(existingUserAction types.UserAction, newUserAction types.UserAction, expectedError error) error

MockUpdate sets expected results for Update

func (*MongoAdapter) Update

func (adapter *MongoAdapter) Update(userAction types.UserAction, updateFieldNames []string) error

Update updates/edits a user action

type QueryAdapter

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

QueryAdapter communicates to IncomingQueryPort

func NewQueryAdapter

func NewQueryAdapter(queryConn messaging2.QueryConnection) *QueryAdapter

NewQueryAdapter ...

func (*QueryAdapter) SetHandlers

func (adapter *QueryAdapter) SetHandlers(handlers ports.IncomingQueryHandlers)

SetHandlers ...

func (*QueryAdapter) Start

func (adapter *QueryAdapter) Start(ctx context.Context, wg *sync.WaitGroup) error

Start starts the adapter

Jump to

Keyboard shortcuts

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