Documentation ¶
Index ¶
- Constants
- type Account
- type AccountStatus
- type Repository
- func (r *Repository) AccountGetByUserID(ctx context.Context, aid string) (*Account, error)
- func (r *Repository) GetAccountByID(ctx context.Context, aid string) (*Account, error)
- func (r *Repository) SaveAccount(ctx context.Context, account *Account) error
- func (r *Repository) SaveTransaction(ctx context.Context, trx *Transaction) error
- type Transaction
- type TransactionStatus
Constants ¶
View Source
const ( AccountStatusRegistered AccountStatus = "REGISTERED" AccountStatusRejected AccountStatus = "REJECTED" TransactionStatusSucceed TransactionStatus = "SUCCEED" TransactionStatusFailed TransactionStatus = "FAILED" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { AccountID string `json:"account_id"` UserID string `json:"user_id"` Status AccountStatus `json:"status"` RejectReason string `json:"reject_reason"` }
type AccountStatus ¶
type AccountStatus string
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(addr string, db int) *Repository
func (*Repository) AccountGetByUserID ¶
func (*Repository) GetAccountByID ¶
func (*Repository) SaveAccount ¶
func (r *Repository) SaveAccount(ctx context.Context, account *Account) error
func (*Repository) SaveTransaction ¶
func (r *Repository) SaveTransaction(ctx context.Context, trx *Transaction) error
type Transaction ¶
type Transaction struct { TransactionID string `json:"transaction_id"` AccountID string `json:"account_id"` Amount int `json:"amount"` Status TransactionStatus `json:"status"` FailedReason string `json:"failed_reason"` }
type TransactionStatus ¶
type TransactionStatus string
Click to show internal directories.
Click to hide internal directories.