Documentation ¶
Overview ¶
Package operation is a generated GoMock package.
Index ¶
- type Amount
- type Balance
- type MockRepository
- func (m *MockRepository) Create(ctx context.Context, operation *Operation) (*Operation, error)
- func (m *MockRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
- func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
- func (m *MockRepository) Find(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID) (*Operation, error)
- func (m *MockRepository) FindAll(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID, ...) ([]*Operation, http.CursorPagination, error)
- func (m *MockRepository) FindAllByAccount(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, ...) ([]*Operation, http.CursorPagination, error)
- func (m *MockRepository) FindAllByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, ...) ([]*Operation, http.CursorPagination, error)
- func (m *MockRepository) FindByAccount(ctx context.Context, organizationID, ledgerID, accountID, id uuid.UUID) (*Operation, error)
- func (m *MockRepository) FindByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID) (*Operation, error)
- func (m *MockRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Operation, error)
- func (m *MockRepository) Update(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID, ...) (*Operation, error)
- type MockRepositoryMockRecorder
- func (mr *MockRepositoryMockRecorder) Create(ctx, operation any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Delete(ctx, organizationID, ledgerID, id any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Find(ctx, organizationID, ledgerID, transactionID, id any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) FindAll(ctx, organizationID, ledgerID, transactionID, filter any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) FindAllByAccount(ctx, organizationID, ledgerID, accountID, filter any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) FindAllByPortfolio(ctx, organizationID, ledgerID, portfolioID, filter any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) FindByAccount(ctx, organizationID, ledgerID, accountID, id any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) FindByPortfolio(ctx, organizationID, ledgerID, portfolioID, id any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) ListByIDs(ctx, organizationID, ledgerID, ids any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Update(ctx, organizationID, ledgerID, transactionID, id, operation any) *gomock.Call
- type Operation
- type OperationLog
- type OperationPostgreSQLModel
- type OperationPostgreSQLRepository
- func (r *OperationPostgreSQLRepository) Create(ctx context.Context, operation *Operation) (*Operation, error)
- func (r *OperationPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
- func (r *OperationPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID) (*Operation, error)
- func (r *OperationPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID, ...) ([]*Operation, http.CursorPagination, error)
- func (r *OperationPostgreSQLRepository) FindAllByAccount(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, ...) ([]*Operation, http.CursorPagination, error)
- func (r *OperationPostgreSQLRepository) FindAllByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, ...) ([]*Operation, http.CursorPagination, error)
- func (r *OperationPostgreSQLRepository) FindByAccount(ctx context.Context, organizationID, ledgerID, accountID, id uuid.UUID) (*Operation, error)
- func (r *OperationPostgreSQLRepository) FindByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID) (*Operation, error)
- func (r *OperationPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Operation, error)
- func (r *OperationPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID, ...) (*Operation, error)
- type Repository
- type Status
- type UpdateOperationInput
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.
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.
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) EXPECT ¶
func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRepository) Find ¶
func (m *MockRepository) Find(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID) (*Operation, error)
Find mocks base method.
func (*MockRepository) FindAll ¶
func (m *MockRepository) FindAll(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID, filter http.Pagination) ([]*Operation, http.CursorPagination, error)
FindAll mocks base method.
func (*MockRepository) FindAllByAccount ¶
func (m *MockRepository) FindAllByAccount(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, filter http.Pagination) ([]*Operation, http.CursorPagination, error)
FindAllByAccount mocks base method.
func (*MockRepository) FindAllByPortfolio ¶
func (m *MockRepository) FindAllByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, filter http.Pagination) ([]*Operation, http.CursorPagination, error)
FindAllByPortfolio mocks base method.
func (*MockRepository) FindByAccount ¶
func (m *MockRepository) FindByAccount(ctx context.Context, organizationID, ledgerID, accountID, id uuid.UUID) (*Operation, error)
FindByAccount mocks base method.
func (*MockRepository) FindByPortfolio ¶
func (m *MockRepository) FindByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID) (*Operation, error)
FindByPortfolio 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, operation any) *gomock.Call
Create indicates an expected call of Create.
func (*MockRepositoryMockRecorder) Delete ¶
func (mr *MockRepositoryMockRecorder) Delete(ctx, organizationID, ledgerID, id any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockRepositoryMockRecorder) Find ¶
func (mr *MockRepositoryMockRecorder) Find(ctx, organizationID, ledgerID, transactionID, id any) *gomock.Call
Find indicates an expected call of Find.
func (*MockRepositoryMockRecorder) FindAll ¶
func (mr *MockRepositoryMockRecorder) FindAll(ctx, organizationID, ledgerID, transactionID, filter any) *gomock.Call
FindAll indicates an expected call of FindAll.
func (*MockRepositoryMockRecorder) FindAllByAccount ¶
func (mr *MockRepositoryMockRecorder) FindAllByAccount(ctx, organizationID, ledgerID, accountID, filter any) *gomock.Call
FindAllByAccount indicates an expected call of FindAllByAccount.
func (*MockRepositoryMockRecorder) FindAllByPortfolio ¶
func (mr *MockRepositoryMockRecorder) FindAllByPortfolio(ctx, organizationID, ledgerID, portfolioID, filter any) *gomock.Call
FindAllByPortfolio indicates an expected call of FindAllByPortfolio.
func (*MockRepositoryMockRecorder) FindByAccount ¶
func (mr *MockRepositoryMockRecorder) FindByAccount(ctx, organizationID, ledgerID, accountID, id any) *gomock.Call
FindByAccount indicates an expected call of FindByAccount.
func (*MockRepositoryMockRecorder) FindByPortfolio ¶
func (mr *MockRepositoryMockRecorder) FindByPortfolio(ctx, organizationID, ledgerID, portfolioID, id any) *gomock.Call
FindByPortfolio indicates an expected call of FindByPortfolio.
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.
func (*Operation) ToLog ¶ added in v1.31.0
func (o *Operation) ToLog() *OperationLog
ToLog converts an Operation excluding the fields that are not immutable
type OperationLog ¶ added in v1.31.0
type OperationLog struct { ID string `json:"id" example:"00000000-0000-0000-0000-000000000000"` TransactionID string `json:"transactionId" example:"00000000-0000-0000-0000-000000000000"` 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"` CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z"` }
OperationLog is a struct designed to represent the operation data that should be stored in the audit log
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, filter http.Pagination) ([]*Operation, http.CursorPagination, error)
FindAll retrieves Operations entities from the database.
func (*OperationPostgreSQLRepository) FindAllByAccount ¶
func (r *OperationPostgreSQLRepository) FindAllByAccount(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, filter http.Pagination) ([]*Operation, http.CursorPagination, 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, filter http.Pagination) ([]*Operation, http.CursorPagination, 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.
type Repository ¶
type Repository interface { Create(ctx context.Context, operation *Operation) (*Operation, error) FindAll(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID, filter http.Pagination) ([]*Operation, http.CursorPagination, error) FindAllByAccount(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, filter http.Pagination) ([]*Operation, http.CursorPagination, error) FindAllByPortfolio(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, filter http.Pagination) ([]*Operation, http.CursorPagination, 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.
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.