Help us shape the future of Go! Take the 2026 Go Developer Survey

wallet

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

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

type Adjustment struct {
	UserId     int64
	Balance    *int64
	GiftAmount *int64
	Commission *int64
}

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
}

func (Wallet) TableName

func (Wallet) TableName() string

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

Jump to

Keyboard shortcuts

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