31 lines
1.0 KiB
Go
31 lines
1.0 KiB
Go
|
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 建立錢包組合(某人的可用,凍結,限制三種)
|
||
|
Create(ctx context.Context, uid, currency, brand string) ([]*model.Wallet, error)
|
||
|
// Balances 取得某個人的餘額
|
||
|
Balances(ctx context.Context, req BalanceReq) ([]model.Wallet, error)
|
||
|
// GetTxDatabaseConn 取得 sql 要做 tx 的連線
|
||
|
GetTxDatabaseConn() sqlx.SqlConn
|
||
|
// GetUserWalletOperator 取得使用者錢包操作看使否需要使用 transaction
|
||
|
GetUserWalletOperator(uid, currency string, opts ...Option) UserWalletOperator
|
||
|
}
|
||
|
|
||
|
// BalanceReq 取得全部的,因為一個人錢包種類的不會太多,故全撈
|
||
|
type BalanceReq struct {
|
||
|
UID []string
|
||
|
Currency []string
|
||
|
Kind []domain.WalletType
|
||
|
}
|
||
|
|
||
|
type Option func() sqlx.SqlConn
|