package repository import ( "app-cloudep-trade-service/internal/domain" "app-cloudep-trade-service/internal/model" "context" "github.com/zeromicro/go-zero/core/stores/sqlx" ) // WalletRepository 錢包基礎操作(可能有平台,使用者等多元的錢包) type WalletRepository interface { // Create 建立錢包(某 id 的可用,凍結,限制三種) Create(ctx context.Context, uid, currency, brand string) ([]*model.Wallet, error) // Balances 取得某個錢包的餘額 Balances(ctx context.Context, req BalanceReq) ([]model.Wallet, error) // GetUserWalletOperator 取得使用者錢包操作看使否需要使用 transaction GetUserWalletOperator(uid, currency string, opts ...Option) UserWalletOperator // Transaction 把 tx 暴露出來 Transaction(ctx context.Context, fn func(tx sqlx.Session) error) error } // BalanceReq 取得全部的,因為一個人錢包種類的不會太多,故全撈 type BalanceReq struct { UID []string Currency []string Kind []domain.WalletType } type Option func() sqlx.SqlConn