transaction

package
v1.31.0-beta.10 Latest Latest
Warning

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

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

Documentation

Overview

Package transaction is a generated GoMock package.

Index

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

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

Find mocks base method.

func (*MockRepository) FindAll

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

FindAll mocks base method.

func (*MockRepository) ListByIDs

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

ListByIDs mocks base method.

func (*MockRepository) Update

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

Find indicates an expected call of Find.

func (*MockRepositoryMockRecorder) FindAll

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

FindAll indicates an expected call of FindAll.

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 any) *gomock.Call

Update indicates an expected call of Update.

type Repository

type Repository interface {
	Create(ctx context.Context, transaction *Transaction) (*Transaction, error)
	FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, limit, page int) ([]*Transaction, 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.

func (Status) IsEmpty

func (s Status) IsEmpty() bool

IsEmpty method that set empty or nil in fields

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

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, limit, page int) ([]*Transaction, 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.

Jump to

Keyboard shortcuts

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