Documentation
¶
Index ¶
Constants ¶
View Source
const AggregateType = "asset"
AggregateType represents the asset aggregate type.
Variables ¶
View Source
var ( // ErrMoneyAmountCannotBeNegative represents the error when the money amount is negative. ErrMoneyAmountCannotBeNegative = errors.New("money amount cannot be negative") // ErrUnsupportedCurrency represents the error when the money currency is invalid. ErrUnsupportedCurrency = errors.New("currency not supported, please use USD or EUR") )
View Source
var ( // ErrAssetNameIsRequired represents the error when the asset name is required. ErrAssetNameIsRequired = errors.New("asset name is required") // ErrAssetTypeIsRequired represents the error when the asset type is required. ErrAssetTypeIsRequired = errors.New("asset type is required") // ErrAssetMoneyIsInvalid represents the error when the asset money is invalid. ErrAssetMoneyIsInvalid = errors.New("asset money is invalid") // ErrAssetNotFound represents the error when the asset is not found. ErrAssetNotFound = errors.New("asset not found") // ErrAssetAlreadyExists represents the error when the asset already exists. ErrAssetAlreadyExists = errors.New("asset already exists with given identifier") )
View Source
var ( // ErrInvalidAssetType represents the error when the asset type is invalid. ErrInvalidAssetType = errors.New("invalid asset type") )
Functions ¶
This section is empty.
Types ¶
type Asset ¶
Asset represents any resource owned or controlled by a business or an economic entity that can be converted into cash.
func (*Asset) MarkAsDeleted ¶
func (a *Asset) MarkAsDeleted()
MarkAsDeleted deletes the asset by given ID.
type AssetType ¶
type AssetType string
AssetType represents the asset type.
const ( // AssetTypeCash represents the cash asset type. AssetTypeCash AssetType = "cash" // AssetTypeBank represents the bank asset type. AssetTypeBank AssetType = "bank" // AssetTypeInvestment represents the investment asset type. AssetTypeInvestment AssetType = "investment" // AssetTypeOther represents the other asset type. AssetTypeOther AssetType = "other" )
type Currency ¶
type Currency string
Currency returns the money currency code.
type Money ¶
Money represents the asset money.
type Repository ¶
type Repository interface { // Save saves all the asset uncommited events to the event store Save(ctx context.Context, asset *Asset) error // GetByID returns the asset by the given ID GetByID(ctx context.Context, id uuid.UUID) (*Asset, error) // GetAll returns all the assets GetAll(ctx context.Context) ([]*Asset, error) // Exists checks if an asset with the given ID exists Exists(ctx context.Context, id uuid.UUID) (bool, error) }
Repository is the interface that wraps the basic asset repository methods.
Click to show internal directories.
Click to hide internal directories.