account

package
v1.25.0-beta.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID              string         `json:"id"`
	Name            string         `json:"name"`
	ParentAccountID *string        `json:"parentAccountId"`
	EntityID        string         `json:"entityId"`
	AssetCode       string         `json:"assetCode"`
	OrganizationID  string         `json:"organizationId"`
	LedgerID        string         `json:"ledgerId"`
	PortfolioID     string         `json:"portfolioId"`
	ProductID       *string        `json:"productId"`
	Balance         Balance        `json:"balance"`
	Status          Status         `json:"status"`
	Alias           *string        `json:"alias"`
	Type            string         `json:"type"`
	CreatedAt       time.Time      `json:"createdAt"`
	UpdatedAt       time.Time      `json:"updatedAt"`
	DeletedAt       *time.Time     `json:"deletedAt"`
	Metadata        map[string]any `json:"metadata"`
}

Account is a struct designed to encapsulate response payload data.

func (*Account) ToProto added in v1.13.0

func (e *Account) ToProto() *proto.Account

ToProto converts entity Account to a response protobuf proto

type AccountPostgreSQLModel

type AccountPostgreSQLModel struct {
	ID                string
	Name              string
	ParentAccountID   *string
	EntityID          string
	AssetCode         string
	OrganizationID    string
	LedgerID          string
	PortfolioID       string
	ProductID         *string
	AvailableBalance  *float64
	OnHoldBalance     *float64
	BalanceScale      *float64
	Status            string
	StatusDescription *string
	AllowSending      bool
	AllowReceiving    bool
	Alias             *string
	Type              string
	CreatedAt         time.Time
	UpdatedAt         time.Time
	DeletedAt         sql.NullTime
	Metadata          map[string]any
}

AccountPostgreSQLModel represents the entity Account into SQL context in Database

func (*AccountPostgreSQLModel) FromEntity

func (t *AccountPostgreSQLModel) FromEntity(account *Account)

FromEntity converts a request entity Account to AccountPostgreSQLModel

func (*AccountPostgreSQLModel) ToEntity

func (t *AccountPostgreSQLModel) ToEntity() *Account

ToEntity converts an AccountPostgreSQLModel to a response entity Account

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 CreateAccountInput

type CreateAccountInput struct {
	AssetCode       string         `json:"assetCode" validate:"required,max=100"`
	Name            string         `json:"name" validate:"max=256"`
	Alias           *string        `json:"alias" validate:"max=100"`
	Type            string         `json:"type" validate:"required"`
	ParentAccountID *string        `json:"parentAccountId" validate:"omitempty,uuid"`
	ProductID       *string        `json:"productId" validate:"omitempty,uuid"`
	EntityID        *string        `json:"entityId" validate:"omitempty,max=256"`
	Status          Status         `json:"status"`
	Metadata        map[string]any `json:"metadata"`
}

CreateAccountInput is a struct design to encapsulate request create payload data.

type Repository

type Repository interface {
	Create(ctx context.Context, account *Account) (*Account, error)
	FindAll(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, limit, page int) ([]*Account, error)
	Find(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID) (*Account, error)
	FindByAlias(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, alias string) (bool, error)
	ListByIDs(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, ids []uuid.UUID) ([]*Account, error)
	ListByAlias(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, alias []string) ([]*Account, error)
	Update(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID, account *Account) (*Account, error)
	Delete(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID) error
	ListAccountsByIDs(ctx context.Context, ids []uuid.UUID) ([]*Account, error)
	ListAccountsByAlias(ctx context.Context, aliases []string) ([]*Account, error)
	UpdateAccountByID(ctx context.Context, id uuid.UUID, account *Account) (*Account, error)
}

Repository provides an interface for operations related to account entities.

type Status

type Status struct {
	Code           string  `json:"code" validate:"max=100"`
	Description    *string `json:"description" validate:"max=256"`
	AllowSending   bool    `json:"allowSending"`
	AllowReceiving bool    `json:"allowReceiving"`
}

Status structure for marshaling/unmarshalling JSON.

func (Status) IsEmpty

func (s Status) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type UpdateAccountInput

type UpdateAccountInput struct {
	Name      string         `json:"name" validate:"max=256"`
	Status    Status         `json:"status"`
	Alias     *string        `json:"alias" validate:"max=100"`
	ProductID *string        `json:"productId" validate:"uuid"`
	Metadata  map[string]any `json:"metadata"`
}

UpdateAccountInput is a struct design to encapsulate request update payload data.

Jump to

Keyboard shortcuts

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