assetrate

package
v1.31.0-beta.17 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package assetrate is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetRate

type AssetRate struct {
	ID             string         `json:"id" example:"00000000-0000-0000-0000-000000000000"`
	OrganizationID string         `json:"organizationId" example:"00000000-0000-0000-0000-000000000000"`
	LedgerID       string         `json:"ledgerId" example:"00000000-0000-0000-0000-000000000000"`
	ExternalID     string         `json:"externalId" example:"00000000-0000-0000-0000-000000000000"`
	From           string         `json:"from" example:"USD"`
	To             string         `json:"to" example:"BRL"`
	Rate           float64        `json:"rate" example:"100"`
	Scale          *float64       `json:"scale" example:"2"`
	Source         *string        `json:"source" example:"External System"`
	TTL            int            `json:"ttl" example:"3600"`
	CreatedAt      time.Time      `json:"createdAt" example:"2021-01-01T00:00:00Z"`
	UpdatedAt      time.Time      `json:"updatedAt" example:"2021-01-01T00:00:00Z"`
	Metadata       map[string]any `json:"metadata"`

} // @name AssetRate

AssetRate is a struct designed to encapsulate response payload data.

swagger:model AssetRate @Description AssetRate is a struct designed to store asset rate data.

type AssetRatePostgreSQLModel

type AssetRatePostgreSQLModel struct {
	ID             string
	OrganizationID string
	LedgerID       string
	ExternalID     string
	From           string
	To             string
	Rate           float64
	RateScale      float64
	Source         *string
	TTL            int
	CreatedAt      time.Time
	UpdatedAt      time.Time
	Metadata       map[string]any
}

AssetRatePostgreSQLModel represents the entity AssetRatePostgreSQLModel into SQL context in Database

func (*AssetRatePostgreSQLModel) FromEntity

func (a *AssetRatePostgreSQLModel) FromEntity(assetRate *AssetRate)

FromEntity converts an entity AssetRate to AssetRatePostgreSQLModel

func (*AssetRatePostgreSQLModel) ToEntity

func (a *AssetRatePostgreSQLModel) ToEntity() *AssetRate

ToEntity converts an TransactionPostgreSQLModel to entity Transaction

type AssetRatePostgreSQLRepository

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

AssetRatePostgreSQLRepository is a Postgresql-specific implementation of the AssetRateRepository.

func NewAssetRatePostgreSQLRepository

func NewAssetRatePostgreSQLRepository(pc *mpostgres.PostgresConnection) *AssetRatePostgreSQLRepository

NewAssetRatePostgreSQLRepository returns a new instance of AssetRatePostgreSQLRepository using the given Postgres connection.

func (*AssetRatePostgreSQLRepository) Create

func (r *AssetRatePostgreSQLRepository) Create(ctx context.Context, assetRate *AssetRate) (*AssetRate, error)

Create a new AssetRate entity into Postgresql and returns it.

func (*AssetRatePostgreSQLRepository) FindAllByAssetCodes

func (r *AssetRatePostgreSQLRepository) FindAllByAssetCodes(ctx context.Context, organizationID, ledgerID uuid.UUID, fromAssetCode string, toAssetCodes []string, limit, page int) ([]*AssetRate, error)

FindAllByAssetCodes returns all asset rates by asset codes.

func (*AssetRatePostgreSQLRepository) FindByCurrencyPair

func (r *AssetRatePostgreSQLRepository) FindByCurrencyPair(ctx context.Context, organizationID, ledgerID uuid.UUID, from, to string) (*AssetRate, error)

FindByCurrencyPair an AssetRate entity by its currency pair in Postgresql and returns it.

func (*AssetRatePostgreSQLRepository) FindByExternalID

func (r *AssetRatePostgreSQLRepository) FindByExternalID(ctx context.Context, organizationID, ledgerID, externalID uuid.UUID) (*AssetRate, error)

FindByExternalID an AssetRate entity by its external ID in Postgresql and returns it.

func (*AssetRatePostgreSQLRepository) Update

func (r *AssetRatePostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, assetRate *AssetRate) (*AssetRate, error)

Update an AssetRate entity into Postgresql and returns the AssetRate updated.

type CreateAssetRateInput

type CreateAssetRateInput struct {
	From       string         `json:"from" validate:"required" example:"USD"`
	To         string         `json:"to" validate:"required" example:"BRL"`
	Rate       int            `json:"rate" validate:"required" example:"100"`
	Scale      int            `json:"scale,omitempty" validate:"gte=0" example:"2"`
	Source     *string        `json:"source,omitempty" example:"External System"`
	TTL        *int           `json:"ttl,omitempty" example:"3600"`
	ExternalID *string        `json:"externalId,omitempty" example:"00000000-0000-0000-0000-000000000000"`
	Metadata   map[string]any `json:"metadata,omitempty"`

} // @name CreateAssetRateInput

CreateAssetRateInput is a struct design to encapsulate payload data.

swagger:model CreateAssetRateInput @Description CreateAssetRateInput is the input payload to create an asset rate.

type MockRepository

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

MockRepository is a mock of Repository interface.

func NewMockRepository

func NewMockRepository(ctrl *gomock.Controller) *MockRepository

NewMockRepository creates a new mock instance.

func (*MockRepository) Create

func (m *MockRepository) Create(ctx context.Context, assetRate *AssetRate) (*AssetRate, error)

Create mocks base method.

func (*MockRepository) EXPECT

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

func (*MockRepository) FindAllByAssetCodes

func (m *MockRepository) FindAllByAssetCodes(ctx context.Context, organizationID, ledgerID uuid.UUID, fromAssetCode string, toAssetCodes []string, limit, page int) ([]*AssetRate, error)

FindAllByAssetCodes mocks base method.

func (*MockRepository) FindByCurrencyPair

func (m *MockRepository) FindByCurrencyPair(ctx context.Context, organizationID, ledgerID uuid.UUID, from, to string) (*AssetRate, error)

FindByCurrencyPair mocks base method.

func (*MockRepository) FindByExternalID

func (m *MockRepository) FindByExternalID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*AssetRate, error)

FindByExternalID mocks base method.

func (*MockRepository) Update

func (m *MockRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, assetRate *AssetRate) (*AssetRate, error)

Update mocks base method.

type MockRepositoryMockRecorder

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

MockRepositoryMockRecorder is the mock recorder for MockRepository.

func (*MockRepositoryMockRecorder) Create

func (mr *MockRepositoryMockRecorder) Create(ctx, assetRate any) *gomock.Call

Create indicates an expected call of Create.

func (*MockRepositoryMockRecorder) FindAllByAssetCodes

func (mr *MockRepositoryMockRecorder) FindAllByAssetCodes(ctx, organizationID, ledgerID, fromAssetCode, toAssetCodes, limit, page any) *gomock.Call

FindAllByAssetCodes indicates an expected call of FindAllByAssetCodes.

func (*MockRepositoryMockRecorder) FindByCurrencyPair

func (mr *MockRepositoryMockRecorder) FindByCurrencyPair(ctx, organizationID, ledgerID, from, to any) *gomock.Call

FindByCurrencyPair indicates an expected call of FindByCurrencyPair.

func (*MockRepositoryMockRecorder) FindByExternalID

func (mr *MockRepositoryMockRecorder) FindByExternalID(ctx, organizationID, ledgerID, id any) *gomock.Call

FindByExternalID indicates an expected call of FindByExternalID.

func (*MockRepositoryMockRecorder) Update

func (mr *MockRepositoryMockRecorder) Update(ctx, organizationID, ledgerID, id, assetRate any) *gomock.Call

Update indicates an expected call of Update.

type Repository

type Repository interface {
	Create(ctx context.Context, assetRate *AssetRate) (*AssetRate, error)
	FindByCurrencyPair(ctx context.Context, organizationID, ledgerID uuid.UUID, from, to string) (*AssetRate, error)
	FindByExternalID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*AssetRate, error)
	FindAllByAssetCodes(ctx context.Context, organizationID, ledgerID uuid.UUID, fromAssetCode string, toAssetCodes []string, limit, page int) ([]*AssetRate, error)
	Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, assetRate *AssetRate) (*AssetRate, error)
}

Repository provides an interface for asset_rate template entities.

Jump to

Keyboard shortcuts

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