operation

package
v1.29.0-beta.17 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package operation is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amount

type Amount struct {
	Amount *float64 `json:"amount" example:"1500"`
	Scale  *float64 `json:"scale" example:"2"`

} // @name Amount

Amount structure for marshaling/unmarshalling JSON.

swagger:model Amount @Description Amount is the struct designed to represent the amount of an operation.

func (Amount) IsEmpty

func (a Amount) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type Balance

type Balance struct {
	Available *float64 `json:"available" example:"1500"`
	OnHold    *float64 `json:"onHold" example:"500"`
	Scale     *float64 `json:"scale" example:"2"`

} // @name Balance

Balance structure for marshaling/unmarshalling JSON.

swagger:model Balance @Description Balance is the struct designed to represent the account balance.

func (Balance) IsEmpty

func (b Balance) IsEmpty() bool

IsEmpty method that set empty or nil in fields

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(arg0 context.Context, arg1 *Operation) (*Operation, error)

Create mocks base method.

func (*MockRepository) Delete

func (m *MockRepository) Delete(arg0 context.Context, arg1, arg2, arg3 uuid.UUID) error

Delete mocks base method.

func (*MockRepository) EXPECT

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

func (*MockRepository) Find

func (m *MockRepository) Find(arg0 context.Context, arg1, arg2, arg3, arg4 uuid.UUID) (*Operation, error)

Find mocks base method.

func (*MockRepository) FindAll

func (m *MockRepository) FindAll(arg0 context.Context, arg1, arg2, arg3 uuid.UUID, arg4, arg5 int) ([]*Operation, error)

FindAll mocks base method.

func (*MockRepository) FindAllByAccount

func (m *MockRepository) FindAllByAccount(arg0 context.Context, arg1, arg2, arg3 uuid.UUID, arg4, arg5 int) ([]*Operation, error)

FindAllByAccount mocks base method.

func (*MockRepository) FindAllByPortfolio

func (m *MockRepository) FindAllByPortfolio(arg0 context.Context, arg1, arg2, arg3 uuid.UUID, arg4, arg5 int) ([]*Operation, error)

FindAllByPortfolio mocks base method.

func (*MockRepository) FindByAccount

func (m *MockRepository) FindByAccount(arg0 context.Context, arg1, arg2, arg3, arg4 uuid.UUID) (*Operation, error)

FindByAccount mocks base method.

func (*MockRepository) FindByPortfolio

func (m *MockRepository) FindByPortfolio(arg0 context.Context, arg1, arg2, arg3, arg4 uuid.UUID) (*Operation, error)

FindByPortfolio mocks base method.

func (*MockRepository) ListByIDs

func (m *MockRepository) ListByIDs(arg0 context.Context, arg1, arg2 uuid.UUID, arg3 []uuid.UUID) ([]*Operation, error)

ListByIDs mocks base method.

func (*MockRepository) Update

func (m *MockRepository) Update(arg0 context.Context, arg1, arg2, arg3, arg4 uuid.UUID, arg5 *Operation) (*Operation, 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(arg0, arg1 any) *gomock.Call

Create indicates an expected call of Create.

func (*MockRepositoryMockRecorder) Delete

func (mr *MockRepositoryMockRecorder) Delete(arg0, arg1, arg2, arg3 any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockRepositoryMockRecorder) Find

func (mr *MockRepositoryMockRecorder) Find(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

Find indicates an expected call of Find.

func (*MockRepositoryMockRecorder) FindAll

func (mr *MockRepositoryMockRecorder) FindAll(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call

FindAll indicates an expected call of FindAll.

func (*MockRepositoryMockRecorder) FindAllByAccount

func (mr *MockRepositoryMockRecorder) FindAllByAccount(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call

FindAllByAccount indicates an expected call of FindAllByAccount.

func (*MockRepositoryMockRecorder) FindAllByPortfolio

func (mr *MockRepositoryMockRecorder) FindAllByPortfolio(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call

FindAllByPortfolio indicates an expected call of FindAllByPortfolio.

func (*MockRepositoryMockRecorder) FindByAccount

func (mr *MockRepositoryMockRecorder) FindByAccount(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

FindByAccount indicates an expected call of FindByAccount.

func (*MockRepositoryMockRecorder) FindByPortfolio

func (mr *MockRepositoryMockRecorder) FindByPortfolio(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

FindByPortfolio indicates an expected call of FindByPortfolio.

func (*MockRepositoryMockRecorder) ListByIDs

func (mr *MockRepositoryMockRecorder) ListByIDs(arg0, arg1, arg2, arg3 any) *gomock.Call

ListByIDs indicates an expected call of ListByIDs.

func (*MockRepositoryMockRecorder) Update

func (mr *MockRepositoryMockRecorder) Update(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call

Update indicates an expected call of Update.

type Operation

type Operation struct {
	ID              string         `json:"id" example:"00000000-0000-0000-0000-000000000000"`
	TransactionID   string         `json:"transactionId" example:"00000000-0000-0000-0000-000000000000"`
	Description     string         `json:"description" example:"Credit card operation"`
	Type            string         `json:"type" example:"creditCard"`
	AssetCode       string         `json:"assetCode" example:"BRL"`
	ChartOfAccounts string         `json:"chartOfAccounts" example:"1000"`
	Amount          Amount         `json:"amount"`
	Balance         Balance        `json:"balance"`
	BalanceAfter    Balance        `json:"balanceAfter"`
	Status          Status         `json:"status"`
	AccountID       string         `json:"accountId" example:"00000000-0000-0000-0000-000000000000"`
	AccountAlias    string         `json:"accountAlias" example:"@person1"`
	PortfolioID     *string        `json:"portfolioId" 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"`
	CreatedAt       time.Time      `json:"createdAt" example:"2021-01-01T00:00:00Z"`
	UpdatedAt       time.Time      `json:"updatedAt" example:"2021-01-01T00:00:00Z"`
	DeletedAt       *time.Time     `json:"deletedAt" example:"2021-01-01T00:00:00Z"`
	Metadata        map[string]any `json:"metadata"`

} // @name Operation

Operation is a struct designed to encapsulate response payload data.

swagger:model Operation @Description Operation is a struct designed to store operation data.

type OperationPostgreSQLModel

type OperationPostgreSQLModel struct {
	ID                    string
	TransactionID         string
	Description           string
	Type                  string
	AssetCode             string
	Amount                *float64
	AmountScale           *float64
	AvailableBalance      *float64
	BalanceScale          *float64
	OnHoldBalance         *float64
	AvailableBalanceAfter *float64
	OnHoldBalanceAfter    *float64
	BalanceScaleAfter     *float64
	Status                string
	StatusDescription     *string
	AccountID             string
	AccountAlias          string
	PortfolioID           *string
	ChartOfAccounts       string
	OrganizationID        string
	LedgerID              string
	CreatedAt             time.Time
	UpdatedAt             time.Time
	DeletedAt             sql.NullTime
	Metadata              map[string]any
}

OperationPostgreSQLModel represents the entity OperationPostgreSQLModel into SQL context in Database

func (*OperationPostgreSQLModel) FromEntity

func (t *OperationPostgreSQLModel) FromEntity(operation *Operation)

FromEntity converts an entity Operation to OperationPostgreSQLModel

func (*OperationPostgreSQLModel) ToEntity

func (t *OperationPostgreSQLModel) ToEntity() *Operation

ToEntity converts an OperationPostgreSQLModel to entity Operation

type OperationPostgreSQLRepository

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

OperationPostgreSQLRepository is a Postgresql-specific implementation of the OperationRepository.

func NewOperationPostgreSQLRepository

func NewOperationPostgreSQLRepository(pc *mpostgres.PostgresConnection) *OperationPostgreSQLRepository

NewOperationPostgreSQLRepository returns a new instance of OperationPostgreSQLRepository using the given Postgres connection.

func (*OperationPostgreSQLRepository) Create

func (r *OperationPostgreSQLRepository) Create(ctx context.Context, operation *Operation) (*Operation, error)

Create a new Operation entity into Postgresql and returns it.

func (*OperationPostgreSQLRepository) Delete

func (r *OperationPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error

Delete removes a Operation entity from the database using the provided IDs.

func (*OperationPostgreSQLRepository) Find

func (r *OperationPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID) (*Operation, error)

Find retrieves a Operation entity from the database using the provided ID.

func (*OperationPostgreSQLRepository) FindAll

func (r *OperationPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID, limit, page int) ([]*Operation, error)

FindAll retrieves Operations entities from the database.

func (*OperationPostgreSQLRepository) FindAllByAccount

func (r *OperationPostgreSQLRepository) FindAllByAccount(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, limit, page int) ([]*Operation, error)

FindAllByAccount retrieves Operations entities from the database using the provided account ID.

func (*OperationPostgreSQLRepository) FindAllByPortfolio

func (r *OperationPostgreSQLRepository) FindAllByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, limit, page int) ([]*Operation, error)

FindAllByPortfolio retrieves Operations entities from the database using the provided portfolio ID.

func (*OperationPostgreSQLRepository) FindByAccount

func (r *OperationPostgreSQLRepository) FindByAccount(ctx context.Context, organizationID, ledgerID, accountID, id uuid.UUID) (*Operation, error)

FindByAccount retrieves a Operation entity from the database using the provided account ID.

func (*OperationPostgreSQLRepository) FindByPortfolio

func (r *OperationPostgreSQLRepository) FindByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID) (*Operation, error)

FindByPortfolio retrieves a Operation entity from the database using the provided portfolio ID.

func (*OperationPostgreSQLRepository) ListByIDs

func (r *OperationPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Operation, error)

ListByIDs retrieves Operation entities from the database using the provided IDs.

func (*OperationPostgreSQLRepository) Update

func (r *OperationPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID, operation *Operation) (*Operation, error)

Update a Operation entity into Postgresql and returns the Operation updated.

type Repository

type Repository interface {
	Create(ctx context.Context, operation *Operation) (*Operation, error)
	FindAll(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID, limit, page int) ([]*Operation, error)
	FindAllByAccount(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, limit, page int) ([]*Operation, error)
	FindAllByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, limit, page int) ([]*Operation, error)
	Find(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID) (*Operation, error)
	FindByAccount(ctx context.Context, organizationID, ledgerID, accountID, id uuid.UUID) (*Operation, error)
	FindByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID) (*Operation, error)
	ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Operation, error)
	Update(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID, operation *Operation) (*Operation, error)
	Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
}

Repository provides an interface for operations related to operation template entities.

type Status

type Status struct {
	Code        string  `json:"code" validate:"max=100" example:"ACTIVE"`
	Description *string `json:"description" validate:"omitempty,max=256" example:"Active status"`

} // @name Status

Status structure for marshaling/unmarshalling JSON.

swagger:model Status @Description Status is the struct designed to represent the status of an operation.

func (Status) IsEmpty

func (s Status) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type UpdateOperationInput

type UpdateOperationInput struct {
	Description string         `json:"description" validate:"max=256" example:"Credit card operation"`
	Metadata    map[string]any `json:"metadata,omitempty"`

} // @name UpdateOperationInput

UpdateOperationInput is a struct design to encapsulate payload data.

swagger:model UpdateOperationInput @Description UpdateOperationInput is the input payload to update an operation.

Jump to

Keyboard shortcuts

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