Documentation
¶
Index ¶
- type UseCase
- func (uc *UseCase) CreateAccount(ctx context.Context, organizationID, ledgerID uuid.UUID, ...) (*mmodel.Account, error)
- func (uc *UseCase) CreateAccountType(ctx context.Context, organizationID, ledgerID uuid.UUID, ...) (*mmodel.AccountType, error)
- func (uc *UseCase) CreateAsset(ctx context.Context, organizationID, ledgerID uuid.UUID, ...) (*mmodel.Asset, error)
- func (uc *UseCase) CreateLedger(ctx context.Context, organizationID uuid.UUID, cli *mmodel.CreateLedgerInput) (*mmodel.Ledger, error)
- func (uc *UseCase) CreateMetadata(ctx context.Context, entityName, entityID string, metadata map[string]any) (map[string]any, error)
- func (uc *UseCase) CreateOrganization(ctx context.Context, coi *mmodel.CreateOrganizationInput) (*mmodel.Organization, error)
- func (uc *UseCase) CreatePortfolio(ctx context.Context, organizationID, ledgerID uuid.UUID, ...) (*mmodel.Portfolio, error)
- func (uc *UseCase) CreateSegment(ctx context.Context, organizationID, ledgerID uuid.UUID, ...) (*mmodel.Segment, error)
- func (uc *UseCase) DeleteAccountByID(ctx context.Context, organizationID, ledgerID uuid.UUID, ...) error
- func (uc *UseCase) DeleteAccountTypeByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
- func (uc *UseCase) DeleteAssetByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
- func (uc *UseCase) DeleteLedgerByID(ctx context.Context, organizationID, id uuid.UUID) error
- func (uc *UseCase) DeleteOrganizationByID(ctx context.Context, id uuid.UUID) error
- func (uc *UseCase) DeletePortfolioByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
- func (uc *UseCase) DeleteSegmentByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
- func (uc *UseCase) UpdateAccount(ctx context.Context, organizationID, ledgerID uuid.UUID, ...) (*mmodel.Account, error)
- func (uc *UseCase) UpdateAccountType(ctx context.Context, organizationID, ledgerID uuid.UUID, id uuid.UUID, ...) (*mmodel.AccountType, error)
- func (uc *UseCase) UpdateAssetByID(ctx context.Context, organizationID, ledgerID uuid.UUID, id uuid.UUID, ...) (*mmodel.Asset, error)
- func (uc *UseCase) UpdateLedgerByID(ctx context.Context, organizationID, id uuid.UUID, ...) (*mmodel.Ledger, error)
- func (uc *UseCase) UpdateMetadata(ctx context.Context, entityName, entityID string, metadata map[string]any) (map[string]any, error)
- func (uc *UseCase) UpdateOrganizationByID(ctx context.Context, id uuid.UUID, uoi *mmodel.UpdateOrganizationInput) (*mmodel.Organization, error)
- func (uc *UseCase) UpdatePortfolioByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID, ...) (*mmodel.Portfolio, error)
- func (uc *UseCase) UpdateSegmentByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID, ...) (*mmodel.Segment, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UseCase ¶
type UseCase struct {
// OrganizationRepo provides an abstraction on top of the organization data source.
OrganizationRepo organization.Repository
// LedgerRepo provides an abstraction on top of the ledger data source.
LedgerRepo ledger.Repository
// SegmentRepo provides an abstraction on top of the segment data source.
SegmentRepo segment.Repository
// PortfolioRepo provides an abstraction on top of the portfolio data source.
PortfolioRepo portfolio.Repository
// AccountRepo provides an abstraction on top of the account data source.
AccountRepo account.Repository
// AssetRepo provides an abstraction on top of the asset data source.
AssetRepo asset.Repository
// AccountTypeRepo provides an abstraction on top of the account type data source.
AccountTypeRepo accounttype.Repository
// MetadataRepo provides an abstraction on top of the metadata data source.
MetadataRepo mongodb.Repository
// RedisRepo provides an abstraction on top of the redis consumer.
RedisRepo redis.RedisRepository
// BalanceGRPCRepo provides an abstraction on top of the balance gRPC client.
BalanceGRPCRepo out.Repository
}
UseCase is a struct that aggregates various repositories for simplified access in use case implementation.
func (*UseCase) CreateAccount ¶
func (uc *UseCase) CreateAccount(ctx context.Context, organizationID, ledgerID uuid.UUID, cai *mmodel.CreateAccountInput, token string) (*mmodel.Account, error)
CreateAccountSync creates an account and metadata, then synchronously creates the default balance via gRPC.
func (*UseCase) CreateAccountType ¶
func (uc *UseCase) CreateAccountType(ctx context.Context, organizationID, ledgerID uuid.UUID, payload *mmodel.CreateAccountTypeInput) (*mmodel.AccountType, error)
CreateAccountType creates a new account type. It returns the created account type and an error if the operation fails.
func (*UseCase) CreateAsset ¶
func (uc *UseCase) CreateAsset(ctx context.Context, organizationID, ledgerID uuid.UUID, cii *mmodel.CreateAssetInput, token string) (*mmodel.Asset, error)
CreateAssetSync creates an asset and metadata synchronously and ensures an external account exists for the asset. If a new external account is created, it also creates the default balance for that account via gRPC.
func (*UseCase) CreateLedger ¶
func (uc *UseCase) CreateLedger(ctx context.Context, organizationID uuid.UUID, cli *mmodel.CreateLedgerInput) (*mmodel.Ledger, error)
CreateLedger creates a new ledger persists data in the repository.
func (*UseCase) CreateMetadata ¶
func (*UseCase) CreateOrganization ¶
func (uc *UseCase) CreateOrganization(ctx context.Context, coi *mmodel.CreateOrganizationInput) (*mmodel.Organization, error)
CreateOrganization creates a new organization persists data in the repository.
func (*UseCase) CreatePortfolio ¶
func (uc *UseCase) CreatePortfolio(ctx context.Context, organizationID, ledgerID uuid.UUID, cpi *mmodel.CreatePortfolioInput) (*mmodel.Portfolio, error)
CreatePortfolio creates a new portfolio persists data in the repository.
func (*UseCase) CreateSegment ¶
func (uc *UseCase) CreateSegment(ctx context.Context, organizationID, ledgerID uuid.UUID, cpi *mmodel.CreateSegmentInput) (*mmodel.Segment, error)
CreateSegment creates a new segment persists data in the repository.
func (*UseCase) DeleteAccountByID ¶
func (uc *UseCase) DeleteAccountByID(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID) error
DeleteAccountByID delete an account from the repository by ids.
func (*UseCase) DeleteAccountTypeByID ¶
func (uc *UseCase) DeleteAccountTypeByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
DeleteAccountTypeByID deletes an account type by its ID. It returns an error if the operation fails or if the account type is not found.
func (*UseCase) DeleteAssetByID ¶
func (uc *UseCase) DeleteAssetByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
DeleteAssetByID delete an asset from the repository by ids.
func (*UseCase) DeleteLedgerByID ¶
DeleteLedgerByID deletes a ledger from the repository
func (*UseCase) DeleteOrganizationByID ¶
DeleteOrganizationByID fetch a new organization from the repository
func (*UseCase) DeletePortfolioByID ¶
func (uc *UseCase) DeletePortfolioByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
DeletePortfolioByID deletes a portfolio from the repository by ids.
func (*UseCase) DeleteSegmentByID ¶
func (uc *UseCase) DeleteSegmentByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error
DeleteSegmentByID delete a segment from the repository by ids.
func (*UseCase) UpdateAccount ¶
func (uc *UseCase) UpdateAccount(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID, uai *mmodel.UpdateAccountInput) (*mmodel.Account, error)
UpdateAccount update an account from the repository by given id.
func (*UseCase) UpdateAccountType ¶
func (uc *UseCase) UpdateAccountType(ctx context.Context, organizationID, ledgerID uuid.UUID, id uuid.UUID, input *mmodel.UpdateAccountTypeInput) (*mmodel.AccountType, error)
UpdateAccountType updates an account type by its ID. It returns the updated account type and an error if the operation fails.
func (*UseCase) UpdateAssetByID ¶
func (uc *UseCase) UpdateAssetByID(ctx context.Context, organizationID, ledgerID uuid.UUID, id uuid.UUID, uii *mmodel.UpdateAssetInput) (*mmodel.Asset, error)
UpdateAssetByID update an asset from the repository by given id.
func (*UseCase) UpdateLedgerByID ¶
func (uc *UseCase) UpdateLedgerByID(ctx context.Context, organizationID, id uuid.UUID, uli *mmodel.UpdateLedgerInput) (*mmodel.Ledger, error)
UpdateLedgerByID update a ledger from the repository.
func (*UseCase) UpdateMetadata ¶
func (*UseCase) UpdateOrganizationByID ¶
func (uc *UseCase) UpdateOrganizationByID(ctx context.Context, id uuid.UUID, uoi *mmodel.UpdateOrganizationInput) (*mmodel.Organization, error)
UpdateOrganizationByID update an organization from the repository.
Source Files
¶
- command.go
- create-account-type.go
- create-account.go
- create-asset.go
- create-ledger.go
- create-metadata.go
- create-organization.go
- create-portfolio.go
- create-segment.go
- delete-account-type.go
- delete-account.go
- delete-asset.go
- delete-ledger.go
- delete-organization.go
- delete-portfolio.go
- delete-segment.go
- update-account-type.go
- update-account.go
- update-asset.go
- update-ledger.go
- update-metadata.go
- update-organization.go
- update-portfolio.go
- update-segment.go