2024-10-29 14:49:47 +00:00
|
|
|
package repository
|
|
|
|
|
2024-10-30 11:13:56 +00:00
|
|
|
import (
|
|
|
|
"app-cloudep-trade-service/internal/domain"
|
|
|
|
"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 取得多種類別餘額
|
|
|
|
Balances(ctx context.Context, kind []domain.WalletType, opts ...WalletOperatorOption) ([]model.Wallet, error)
|
|
|
|
// LocalBalance 取得本地錢包的數額
|
|
|
|
LocalBalance(kind domain.WalletType) decimal.Decimal
|
|
|
|
// GetBalancesByID 取得錢包的數額 ByID
|
|
|
|
GetBalancesByID(ctx context.Context, ids []int64, opts ...WalletOperatorOption) ([]model.Wallet, error)
|
|
|
|
}
|