transaction

package
v1.26.0-beta.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTransactionInput added in v1.21.0

type CreateTransactionInput struct {
	ChartOfAccountsGroupName string          `json:"chartOfAccountsGroupName" 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                     gold.Send       `json:"send,omitempty"`
	Distribute               gold.Distribute `json:"distribute,omitempty"`
}

CreateTransactionInput is a struct design to encapsulate payload data.

func (*CreateTransactionInput) FromDSl added in v1.21.0

func (cti *CreateTransactionInput) FromDSl() *gold.Transaction

FromDSl converts an entity FromDSl to gold.Transaction

type InputDSL added in v1.8.0

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 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"`
	Description *string `json:"description" validate:"omitempty,max=256"`
}

Status structure for marshaling/unmarshalling JSON.

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"`
	ParentTransactionID      *string        `json:"parentTransactionId,omitempty"`
	Description              string         `json:"description"`
	Template                 string         `json:"template"`
	Status                   Status         `json:"status"`
	Amount                   *float64       `json:"amount"`
	AmountScale              *float64       `json:"amountScale"`
	AssetCode                string         `json:"assetCode"`
	ChartOfAccountsGroupName string         `json:"chartOfAccountsGroupName"`
	Source                   []string       `json:"source"`
	Destination              []string       `json:"destination"`
	LedgerID                 string         `json:"ledgerId"`
	OrganizationID           string         `json:"organizationId"`
	CreatedAt                time.Time      `json:"createdAt"`
	UpdatedAt                time.Time      `json:"updatedAt"`
	DeletedAt                *time.Time     `json:"deletedAt"`
	Metadata                 map[string]any `json:"metadata,omitempty"`
	Operations               []*o.Operation `json:"operations"`
}

Transaction is a struct designed to encapsulate response payload 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 UpdateTransactionInput added in v1.14.0

type UpdateTransactionInput struct {
	Description string         `json:"description" validate:"max=256"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

UpdateTransactionInput 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