transactions

package
v0.0.0-...-902682f Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTransactionRepo

func CreateTransactionRepo(conn *gorm.DB) transactions.Repository

func ToListDomain

func ToListDomain(data []Transaction) (result []transactions.Domain)

Types

type Transaction

type Transaction struct {
	Id                    int `gorm:"primaryKey"`
	UserId                int
	User                  user.User `gorm:"foreignKey:UserId;association_foreignkey:Id"`
	TransactionDate       time.Time
	Transaction           float64
	TransactionAttachment string
	Status                int8
	Point                 float64
	Description           string
	CreatedAt             time.Time
	UpdatedAt             time.Time
}

func FromDomain

func FromDomain(domain transactions.Domain) Transaction

func (*Transaction) ToDomain

func (tr *Transaction) ToDomain() transactions.Domain

type TransactionRepo

type TransactionRepo struct {
	DB *gorm.DB
}

func (*TransactionRepo) Create

func (*TransactionRepo) Delete

func (rep *TransactionRepo) Delete(ctx context.Context, id int) error

func (*TransactionRepo) GetAll

func (rep *TransactionRepo) GetAll(ctx context.Context) ([]transactions.Domain, error)

func (*TransactionRepo) GetById

func (rep *TransactionRepo) GetById(ctx context.Context, id int) (transactions.Domain, error)

func (*TransactionRepo) GetByUserId

func (rep *TransactionRepo) GetByUserId(ctx context.Context, id int) ([]transactions.Domain, error)

func (*TransactionRepo) GetByUserIdAndStatus

func (rep *TransactionRepo) GetByUserIdAndStatus(ctx context.Context, id int, sid int) ([]transactions.Domain, error)

func (*TransactionRepo) Update

Jump to

Keyboard shortcuts

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