model

package
v0.0.0-...-ceb02a4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRecordNotFound = errors.New("record not found")

Functions

This section is empty.

Types

type Profile

type Profile struct {
	ID          int64   `json:"id"`
	PhoneNumber string  `json:"phone_number"`
	Balance     float64 `json:"balance"`
}

type ProfileRepo

type ProfileRepo interface {
	FindByPhone(ctx context.Context, phoneNumber string) (*Profile, error)
	Create(context.Context, *Profile) error
	UpdateBalance(context.Context, string, float64) error
}

type SQLProfileRepo

type SQLProfileRepo struct {
	DB *gorm.DB
}

func (*SQLProfileRepo) Create

func (p *SQLProfileRepo) Create(ctx context.Context, profile *Profile) error

func (*SQLProfileRepo) FindByPhone

func (p *SQLProfileRepo) FindByPhone(ctx context.Context, phoneNumber string) (*Profile, error)

func (*SQLProfileRepo) UpdateBalance

func (p *SQLProfileRepo) UpdateBalance(ctx context.Context, phoneNumber string, amount float64) error

type Transaction

type Transaction struct {
	ID        int     `json:"id"`
	ProfileID int64   `json:"profile_id"`
	Amount    float64 `json:"amount"`
}

Jump to

Keyboard shortcuts

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