Documentation ¶
Overview ¶
Package transaction is a generated GoMock package.
Index ¶
- type CreateTransactionInput
- type InputDSL
- type MockRepository
- func (m *MockRepository) Create(ctx context.Context, transaction *Transaction) (*Transaction, 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, id uuid.UUID) (*Transaction, error)
- func (m *MockRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, ...) ([]*Transaction, http.CursorPagination, error)
- func (m *MockRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Transaction, error)
- func (m *MockRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, ...) (*Transaction, error)
- type MockRepositoryMockRecorder
- func (mr *MockRepositoryMockRecorder) Create(ctx, transaction any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Delete(ctx, organizationID, ledgerID, id any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Find(ctx, organizationID, ledgerID, id any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) FindAll(ctx, organizationID, ledgerID, filter any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) ListByIDs(ctx, organizationID, ledgerID, ids any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Update(ctx, organizationID, ledgerID, id, transaction any) *gomock.Call
- type Repository
- type Status
- type Transaction
- type TransactionPostgreSQLModel
- type TransactionPostgreSQLRepository
- func (r *TransactionPostgreSQLRepository) Create(ctx context.Context, transaction *Transaction) (*Transaction, error)
- func (r *TransactionPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
- func (r *TransactionPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*Transaction, error)
- func (r *TransactionPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, ...) ([]*Transaction, http.CursorPagination, error)
- func (r *TransactionPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Transaction, error)
- func (r *TransactionPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, ...) (*Transaction, error)
- type UpdateTransactionInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateTransactionInput ¶
type CreateTransactionInput struct { ChartOfAccountsGroupName string `json:"chartOfAccountsGroupName,omitempty" validate:"max=256"` Description string `json:"description,omitempty" validate:"max=256"` Code string `json:"code,omitempty" validate:"max=100"` Pending bool `json:"pending,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` Send *goldModel.Send `json:"send,omitempty" validate:"required,dive"` Distribute *goldModel.Distribute `json:"distribute,omitempty" validate:"required,dive"` } // @name CreateTransactionInput
CreateTransactionInput is a struct design to encapsulate payload data.
swagger:model CreateTransactionInput @Description CreateTransactionInput is the input payload to create a transaction.
func (*CreateTransactionInput) FromDSl ¶
func (cti *CreateTransactionInput) FromDSl() *goldModel.Transaction
FromDSl converts an entity FromDSl to goldModel.Transaction
type InputDSL ¶
type InputDSL struct { TransactionType uuid.UUID `json:"transactionType"` TransactionTypeCode string `json:"transactionTypeCode"` Variables map[string]any `json:"variables,omitempty"` }
InputDSL is a struct design to encapsulate payload data.
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, transaction *Transaction) (*Transaction, error)
Create mocks base method.
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, id uuid.UUID) (*Transaction, error)
Find mocks base method.
func (*MockRepository) FindAll ¶
func (m *MockRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.Pagination) ([]*Transaction, http.CursorPagination, error)
FindAll mocks base method.
func (*MockRepository) ListByIDs ¶
func (m *MockRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Transaction, error)
ListByIDs mocks base method.
func (*MockRepository) Update ¶
func (m *MockRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, transaction *Transaction) (*Transaction, 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, transaction 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, id any) *gomock.Call
Find indicates an expected call of Find.
func (*MockRepositoryMockRecorder) FindAll ¶
func (mr *MockRepositoryMockRecorder) FindAll(ctx, organizationID, ledgerID, filter any) *gomock.Call
FindAll indicates an expected call of FindAll.
type Repository ¶
type Repository interface { Create(ctx context.Context, transaction *Transaction) (*Transaction, error) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.Pagination) ([]*Transaction, http.CursorPagination, error) Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*Transaction, error) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Transaction, error) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, transaction *Transaction) (*Transaction, error) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error }
Repository provides an interface for operations related to transaction 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 a transaction.
type Transaction ¶
type Transaction struct { ID string `json:"id" example:"00000000-0000-0000-0000-000000000000"` ParentTransactionID *string `json:"parentTransactionId,omitempty" example:"00000000-0000-0000-0000-000000000000"` Description string `json:"description" example:"Transaction description"` Template string `json:"template" example:"Transaction template"` Status Status `json:"status"` Amount *float64 `json:"amount" example:"1500"` AmountScale *float64 `json:"amountScale" example:"2"` AssetCode string `json:"assetCode" example:"BRL"` ChartOfAccountsGroupName string `json:"chartOfAccountsGroupName" example:"Chart of accounts group name"` Source []string `json:"source" example:"@person1"` Destination []string `json:"destination" example:"@person2"` LedgerID string `json:"ledgerId" example:"00000000-0000-0000-0000-000000000000"` OrganizationID string `json:"organizationId" 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,omitempty"` Operations []*operation.Operation `json:"operations"` } // @name Transaction
Transaction is a struct designed to encapsulate response payload data.
swagger:model Transaction @Description Transaction is a struct designed to store transaction data.
type TransactionPostgreSQLModel ¶
type TransactionPostgreSQLModel struct { ID string ParentTransactionID *string Description string Template string Status string StatusDescription *string Amount *float64 AmountScale *float64 AssetCode string ChartOfAccountsGroupName string LedgerID string OrganizationID string CreatedAt time.Time UpdatedAt time.Time DeletedAt sql.NullTime Metadata map[string]any }
TransactionPostgreSQLModel represents the entity TransactionPostgreSQLModel into SQL context in Database
func (*TransactionPostgreSQLModel) FromEntity ¶
func (t *TransactionPostgreSQLModel) FromEntity(transaction *Transaction)
FromEntity converts an entity Transaction to TransactionPostgreSQLModel
func (*TransactionPostgreSQLModel) ToEntity ¶
func (t *TransactionPostgreSQLModel) ToEntity() *Transaction
ToEntity converts an TransactionPostgreSQLModel to entity Transaction
type TransactionPostgreSQLRepository ¶
type TransactionPostgreSQLRepository struct {
// contains filtered or unexported fields
}
TransactionPostgreSQLRepository is a Postgresql-specific implementation of the TransactionRepository.
func NewTransactionPostgreSQLRepository ¶
func NewTransactionPostgreSQLRepository(pc *mpostgres.PostgresConnection) *TransactionPostgreSQLRepository
NewTransactionPostgreSQLRepository returns a new instance of TransactionPostgreSQLRepository using the given Postgres connection.
func (*TransactionPostgreSQLRepository) Create ¶
func (r *TransactionPostgreSQLRepository) Create(ctx context.Context, transaction *Transaction) (*Transaction, error)
Create a new Transaction entity into Postgresql and returns it.
func (*TransactionPostgreSQLRepository) Delete ¶
func (r *TransactionPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
Delete removes a Transaction entity from the database using the provided IDs.
func (*TransactionPostgreSQLRepository) Find ¶
func (r *TransactionPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*Transaction, error)
Find retrieves a Transaction entity from the database using the provided ID.
func (*TransactionPostgreSQLRepository) FindAll ¶
func (r *TransactionPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.Pagination) ([]*Transaction, http.CursorPagination, error)
FindAll retrieves Transactions entities from the database.
func (*TransactionPostgreSQLRepository) ListByIDs ¶
func (r *TransactionPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Transaction, error)
ListByIDs retrieves Transaction entities from the database using the provided IDs.
func (*TransactionPostgreSQLRepository) Update ¶
func (r *TransactionPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, transaction *Transaction) (*Transaction, error)
Update a Transaction entity into Postgresql and returns the Transaction updated.
type UpdateTransactionInput ¶
type UpdateTransactionInput struct { Description string `json:"description" validate:"max=256" example:"Transaction description"` Metadata map[string]any `json:"metadata,omitempty"` } // @name UpdateTransactionInput
UpdateTransactionInput is a struct design to encapsulate payload data.
swagger:model UpdateTransactionInput @Description UpdateTransactionInput is the input payload to update a transaction.