repository

package
v0.0.0-...-33f6294 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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 (r *Repository) AccountGetByUserID(ctx context.Context, aid string) (*Account, error)

func (*Repository) GetAccountByID

func (r *Repository) GetAccountByID(ctx context.Context, aid string) (*Account, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL