operation

package
v1.21.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

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"`
	Scale  *float64 `json:"scale"`
}

Amount structure for marshaling/unmarshalling JSON.

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"`
	OnHold    *float64 `json:"onHold"`
	Scale     *float64 `json:"scale"`
}

Balance structure for marshaling/unmarshalling JSON.

func (Balance) IsEmpty

func (b Balance) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type Operation

type Operation struct {
	ID              string         `json:"id"`
	TransactionID   string         `json:"transactionId"`
	Description     string         `json:"description"`
	Type            string         `json:"type"`
	AssetCode       string         `json:"assetCode"`
	ChartOfAccounts string         `json:"chartOfAccounts"`
	Amount          Amount         `json:"amount"`
	Balance         Balance        `json:"balance"`
	BalanceAfter    Balance        `json:"balanceAfter"`
	Status          Status         `json:"status"`
	AccountID       string         `json:"accountId"`
	AccountAlias    string         `json:"accountAlias"`
	PortfolioID     string         `json:"portfolioId"`
	OrganizationID  string         `json:"organizationId"`
	LedgerID        string         `json:"ledgerId"`
	CreatedAt       time.Time      `json:"createdAt"`
	UpdatedAt       time.Time      `json:"updatedAt"`
	DeletedAt       *time.Time     `json:"deletedAt"`
	Metadata        map[string]any `json:"metadata"`
}

Operation is a struct designed to encapsulate response payload 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 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"`
	Description *string `json:"description"`
}

Status structure for marshaling/unmarshalling JSON.

func (Status) IsEmpty

func (s Status) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type UpdateOperationInput added in v1.18.0

type UpdateOperationInput struct {
	Description string         `json:"description"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

UpdateOperationInput is a struct design to encapsulate payload data.

Jump to

Keyboard shortcuts

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