adapters

package
v0.0.0-...-16fd4a1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientPersistenceAdapter

type ClientPersistenceAdapter interface {
	// GetClient will find model.Client on client repository using clientId as key
	GetClient(clientId string) (*model.Client, custom_error.BaseErrorAdapter)

	// Lock will update model.Client setting flag locked as true on client repository
	Lock(client *model.Client) custom_error.BaseErrorAdapter

	// Unlock will update model.Client setting flag locked as false on client repository
	Unlock(client *model.Client) custom_error.BaseErrorAdapter
}

type ClientServiceAdapter

type ClientServiceAdapter interface {
	// GetBalance will search for client balance on external service. ClientId is used to get the apiKey in credentials
	// DB. If useSimulation is set to true, will redirect the request to the simulation app (used to test the system).
	GetBalance(clientId string, useSimulation bool) (*model.Balance, custom_error.BaseErrorAdapter)
}

type CryptoServiceAdapter

type CryptoServiceAdapter interface {
	// GetCrypto finds and return a model.Coin object containing values to buy and sell a crypto coin based on symbol
	// and quote (symbol.Symbol).
	GetCrypto(symbol symbol.Symbol, quote symbol.Symbol) (*model.Coin, custom_error.BaseErrorAdapter)

	// GetBalance will search for client balance on external service. ClientId is used to get the apiKey in credentials
	// DB.
	GetBalance(clientId string, useSimulation bool) (*model.Balance, custom_error.BaseErrorAdapter)
}

type EventServiceAdapter

type EventServiceAdapter interface {
	// Send event containing object to topic.
	Send(object interface{}) custom_error.BaseErrorAdapter
}

type LockPersistenceAdapter

type LockPersistenceAdapter interface {
	// Lock will set the key on cache with TTL active. Returns error if a problem occurs while trying to persist on cache.
	Lock(key string) custom_error.BaseErrorAdapter

	// Unlock will remove the key from cache. Returns error if a problem occurs while trying to delete from cache.
	Unlock(key string) custom_error.BaseErrorAdapter
}

type LoggerAdapter

type LoggerAdapter interface {
	SetCorrelationID(correlationId string)
	Info(message string, metadata ...interface{})
	Error(err error, message string, metadata ...interface{})
	Warning(err error, message string, metadata ...interface{})
}

type OperationPersistenceAdapter

type OperationPersistenceAdapter interface {
	// Save model.Operation in operation repository.
	Save(operation *model.Operation) custom_error.BaseErrorAdapter
}

type TimeAdapter

type TimeAdapter interface {
	Now() time.Time
}

type ValidationUseCaseAdapter

type ValidationUseCaseAdapter interface {
	// Validate if operation can be executed. client_id key will be locked in cache and locked flag will be set to true on
	// client DB during execution of method. After the operation request is validated with client config, an operation is
	// created and sent to execution via SNS topic.
	Validate(operationRequest *model.OperationRequest) error
}

ValidationUseCaseAdapter adapter for usecase.ValidationUseCase.

Jump to

Keyboard shortcuts

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