instrument

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package instrument is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrModelBuilderInsufficientDataResolved = errors.New("insufficient data resolved")
View Source
var ErrNoMatch = errors.New("value did not match the pattern")

Functions

func ExtractInstrumentISINFromIcon

func ExtractInstrumentISINFromIcon(src string) (string, error)

func ProvideInstrumentRepository

func ProvideInstrumentRepository(db *gorm.DB, logger *logrus.Logger) (*database.Repository[*Model], error)

Types

type MockRepositoryInterface

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

MockRepositoryInterface is a mock of RepositoryInterface interface.

func NewMockRepositoryInterface

func NewMockRepositoryInterface(ctrl *gomock.Controller) *MockRepositoryInterface

NewMockRepositoryInterface creates a new mock instance.

func (*MockRepositoryInterface) Create

func (m *MockRepositoryInterface) Create(model *Model) error

Create mocks base method.

func (*MockRepositoryInterface) EXPECT

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

type MockRepositoryInterfaceMockRecorder

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

MockRepositoryInterfaceMockRecorder is the mock recorder for MockRepositoryInterface.

func (*MockRepositoryInterfaceMockRecorder) Create

Create indicates an expected call of Create.

type Model

type Model struct {
	ISIN string `gorm:"primaryKey"`
	Name string
	Icon string
	Type Type
}

func NewModel

func NewModel(isin, name, icon string, instrumentType Type) Model

func (Model) IconURL

func (i Model) IconURL() string

func (Model) TableName

func (Model) TableName() string

type ModelBuilder

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

func NewModelBuilder

func NewModelBuilder(
	typeResolver TypeResolverInterface,
	logger *log.Logger,
) ModelBuilder

func ProvideModelBuilder

func ProvideModelBuilder(logger *logrus.Logger) ModelBuilder

func (ModelBuilder) Build

func (b ModelBuilder) Build(response details.NormalizedResponse) (Model, error)

func (ModelBuilder) ExtractInstrumentISIN

func (b ModelBuilder) ExtractInstrumentISIN(response details.NormalizedResponse) (string, error)

func (ModelBuilder) ExtractInstrumentIcon

func (b ModelBuilder) ExtractInstrumentIcon(response details.NormalizedResponse) (string, error)

func (ModelBuilder) ExtractInstrumentName

func (b ModelBuilder) ExtractInstrumentName(response details.NormalizedResponse) (string, error)

func (ModelBuilder) HandleErr

func (b ModelBuilder) HandleErr(err error) error

type ModelBuilderInterface

type ModelBuilderInterface interface {
	Build(response details.NormalizedResponse) (Model, error)
}

type RepositoryInterface

type RepositoryInterface interface {
	database.RepositoryInterface[*Model]
}

type Type

type Type string
const (
	TypeStocks         Type = "Stocks"
	TypeETF            Type = "ETF"
	TypeCryptocurrency Type = "Cryptocurrency"
	TypeLending        Type = "Lending"
	TypeCash           Type = "Cash"
	TypeOther          Type = "Other"
)

type TypeResolver

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

func NewTypeResolver

func NewTypeResolver(logger *log.Logger) TypeResolver

func (TypeResolver) Resolve

func (r TypeResolver) Resolve(instrument Model) Type

type TypeResolverInterface

type TypeResolverInterface interface {
	Resolve(instrument Model) Type
}

Jump to

Keyboard shortcuts

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