models

package
Version: v0.0.0-...-5b150e2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitStorage

func InitStorage() (db *gorm.DB, err error)

Types

type Repository

type Repository struct {
	DB *gorm.DB
}

func CreateRepository

func CreateRepository(db *gorm.DB) Repository

func (*Repository) CreditWallet

func (p *Repository) CreditWallet(id int, credit decimal.Decimal) (*types.Wallet, error)

CreditWallet adds a credit amount to the wallet balance

func (*Repository) DebitWallet

func (p *Repository) DebitWallet(id int, debit decimal.Decimal) (*types.Wallet, error)

DebitWallet subtracts a debit amount from the wallet balance, returns error in case not sufficient funds

func (*Repository) GetWalletByID

func (p *Repository) GetWalletByID(id int) (*types.Wallet, error)

GetWalletByID returns a wallet with a specified ID

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL