services

package
v0.0.0-...-c9e3aad Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	SignUp(u *models.User) (*models.User, error)
	SignIn(u *models.User) (*models.User, *models.Session, error)
}

func NewAuth

func NewAuth(
	u repo.User,
	se repo.Session,
	c Cryptor,
) Auth

type Comparer

type Comparer interface {
	Compare(password string, hashed string) error
}

type Cryptor

type Cryptor interface {
	Comparer
	Hasher
}

func NewCryptor

func NewCryptor() Cryptor

type Deal

type Deal interface {
	MakeTransaction(authorID, dealID, amount int) error
	GetByID(id int) (*models.Deal, error)
	GetAllByID(id int) (*models.Deal, error)
	Get() ([]models.Deal, error)
	Create(d *models.Deal) (*models.Deal, error)
	Patch(d *models.Deal) (*models.Deal, error)
	Delete(d int) error
}

func NewDeal

func NewDeal(
	repo repo.Deal,
	irepo repo.Inventory,
	urepo repo.User,
	trepo repo.Transaction,
) Deal

type Hasher

type Hasher interface {
	Hash(password string) (string, error)
}

type Inventory

type Inventory interface {
	GetByID(id int) (*models.InventoryItem, error)
	GetUserInventory(userID int) ([]models.InventoryItem, error)
	GetUserInventoryBySecurityID(userID int, securityID int) (*models.InventoryItem, error)
	Withdraw(ownerID, securityID, amount uint) (*models.InventoryItem, error)
	Add(ownerID, securityID, amount uint) (*models.InventoryItem, error)
	Patch(item *models.InventoryItem) (*models.InventoryItem, error)
	Delete(id int) error
}

func NewInventory

func NewInventory(repo repo.Inventory, ur repo.User, dr repo.Deal) Inventory

type Security

type Security interface {
	Get() ([]models.Security, error)
}

func NewSecurity

func NewSecurity(sr repo.Security) Security

type Transaction

type Transaction interface {
	Get(userID int) ([]models.Transaction, error)
	Add(t *models.Transaction) (*models.Transaction, error)
}

func NewTransaction

func NewTransaction(tr repo.Transaction) Transaction

type User

type User interface {
	GetByID(id int) (*models.User, error)
	Get() ([]models.User, error)
	Patch(user *models.User) (*models.User, error)
	WithdrawMoney(userID, amount int) error
	AddMoney(userID, amount int) error
}

func NewStock

func NewStock(repo repo.User, crypto Cryptor) User

Jump to

Keyboard shortcuts

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