Documentation
¶
Overview ¶
Package wallet holds the billing domain's money entities: the wallet row (the single source of truth for balance/gift/commission since migration 02144) and withdrawal records (ADR-001 step 5).
Index ¶
Constants ¶
View Source
const ( WithdrawalStatusPending uint8 = iota WithdrawalStatusApproved WithdrawalStatusRejected )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adjustment ¶ added in v1.21.0
Adjustment is an administrator's edit of a wallet: each amount that is set becomes the wallet's; a nil amount is left as it is, so a form that only carries the amounts the administrator edited cannot revert the purchases, refunds and claw-backs that happened since it was loaded.
type Wallet ¶
type Wallet struct {
UserId int64 `gorm:"primaryKey"`
Balance int64 `gorm:"not null;default:0;comment:User Balance Amount"`
GiftAmount int64 `gorm:"not null;default:0;comment:User Gift Amount"`
Commission int64 `gorm:"not null;default:0;comment:Commission Amount"`
CreatedAt time.Time
UpdatedAt time.Time
}
type Withdrawal ¶
type Withdrawal struct {
Id int64 `gorm:"primaryKey"`
UserId int64 `gorm:"index:idx_user_id;not null;comment:User ID"`
Amount int64 `gorm:"not null;comment:Withdrawal Amount"`
Content string `gorm:"type:text;comment:Withdrawal Content"`
Status uint8 `gorm:"type:tinyint(1);default:0;comment:Withdrawal Status: 0: Pending 1: Approved 2: Rejected"`
Reason string `gorm:"type:varchar(500);default:'';comment:Rejection Reason"`
CreatedAt time.Time `gorm:"<-:create;comment:Creation Time"`
UpdatedAt time.Time `gorm:"comment:Update Time"`
}
func (*Withdrawal) TableName ¶
func (*Withdrawal) TableName() string
Click to show internal directories.
Click to hide internal directories.