service

package
v0.0.0-...-d33556e Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInsufficientFunds = fmt.Errorf("insufficient funds")
View Source
var ErrNegativeSignTransaction = fmt.Errorf("negative sign")
View Source
var ErrWrongPassword = fmt.Errorf("wrong password")

Functions

This section is empty.

Types

type AuthService

type AuthService interface {
	GetTokenByUsernameAndPassword(ctx context.Context, username string, password string) (*string, error)
}

type AuthServiceImpl

type AuthServiceImpl struct {
	Service
	UserAccessor db.UserAccessor
}

func (*AuthServiceImpl) GetTokenByUsernameAndPassword

func (s *AuthServiceImpl) GetTokenByUsernameAndPassword(ctx context.Context, username string, password string) (*string, error)

type BuyService

type BuyService interface {
	BuyItem(ctx context.Context, username string, itemName string) error
}

type BuyServiceImpl

type BuyServiceImpl struct {
	Service
	UserAccessor     db.UserAccessor
	ItemAccessor     db.ItemAccessor
	UserItemAccessor db.UserItemAccessor
}

func (*BuyServiceImpl) BuyItem

func (s *BuyServiceImpl) BuyItem(ctx context.Context, username string, itemName string) error

type JWTClaims

type JWTClaims struct {
	Username string `json:"username"`
	jwt.RegisteredClaims
}

type SendCoinsService

type SendCoinsService interface {
	SendCoins(ctx context.Context, sender string, receiver string, amount int64) error
}

type SendCoinsServiceImpl

type SendCoinsServiceImpl struct {
	Service
	UserAccessor         db.UserAccessor
	CoinTransferAccessor db.CoinTransferAccessor
}

func (*SendCoinsServiceImpl) SendCoins

func (s *SendCoinsServiceImpl) SendCoins(ctx context.Context, sender string, receiver string, amount int64) error

type Service

type Service interface {
	RunWithTx(ctx context.Context, txFunc func(tx pgx.Tx) error) error
	GetConfig() *config.Config
}

func NewBasicService

func NewBasicService(db db.Db, cfg *config.Config) Service

type UserInfoService

type UserInfoService interface {
	GetUserInfo(ctx context.Context, username string) (balance *int64, userItems []model.UserItem, recievedTransfers []model.CoinTransfer, sentTransfers []model.CoinTransfer, err error)
}

type UserInfoServiceImp

type UserInfoServiceImp struct {
	Service
	UserAccessor         db.UserAccessor
	UserItemAccessor     db.UserItemAccessor
	CoinTransferAccessor db.CoinTransferAccessor
}

func (*UserInfoServiceImp) GetUserInfo

func (s *UserInfoServiceImp) GetUserInfo(ctx context.Context, username string) (balance *int64, userItems []model.UserItem, recievedTransfers []model.CoinTransfer, sentTransfers []model.CoinTransfer, err error)

Jump to

Keyboard shortcuts

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