app-cloudep-trade-service/internal/domain/repository/user_wallet.go

22 lines
791 B
Go
Raw Normal View History

2024-10-29 14:49:47 +00:00
package repository
2024-10-30 11:13:56 +00:00
import (
2024-10-31 04:05:22 +00:00
"app-cloudep-trade-service/internal/domain/wallet"
2024-10-30 11:13:56 +00:00
"app-cloudep-trade-service/internal/model"
"context"
"github.com/shopspring/decimal"
)
// 如果有需要Select for update 的話,請在 Option 當中加上鎖並且傳入 sqlx.conn)
2024-10-29 14:49:47 +00:00
// UserWalletOperator 針對使用者的錢包基本操作接口
2024-10-30 11:13:56 +00:00
type UserWalletOperator interface {
// Balances 取得多種類別餘額
2024-10-31 04:05:22 +00:00
Balances(ctx context.Context, balanceType []wallet.BalanceType, opts ...WalletOperatorOption) ([]model.Wallet, error)
2024-10-30 11:13:56 +00:00
// LocalBalance 取得本地錢包的數額
2024-10-31 04:05:22 +00:00
LocalBalance(balanceType wallet.BalanceType) decimal.Decimal
2024-10-30 11:13:56 +00:00
// GetBalancesByID 取得錢包的數額 ByID
GetBalancesByID(ctx context.Context, ids []int64, opts ...WalletOperatorOption) ([]model.Wallet, error)
}