account

package
v0.0.0-...-514f96b Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddBalanceRequest

type AddBalanceRequest struct {
	AccountID int64 `json:"account_id" binding:"required,gte=1"`
	Amount    int64 `json:"amount"     binding:"gte=0"`
}

func (AddBalanceRequest) ToDTO

type AddBalanceResponse

type AddBalanceResponse struct {
	Balance int64 `json:"balance"`
}

type GetBalanceResponse

type GetBalanceResponse struct {
	Balance int64 `json:"balance"`
}

type Handler

type Handler struct {
	*handler.BaseHandler
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service Service, logger *zap.Logger) *Handler

func (*Handler) AddBalance

func (h *Handler) AddBalance(c *gin.Context)

func (*Handler) GetBalance

func (h *Handler) GetBalance(c *gin.Context)

func (*Handler) InitAPI

func (h *Handler) InitAPI(router *gin.RouterGroup)

func (*Handler) TransferBalance

func (h *Handler) TransferBalance(c *gin.Context)

type Service

type Service interface {
	GetBalanceByID(ctx context.Context, id int64) (int64, error)
	AddBalance(ctx context.Context, dto account.AddBalanceDTO) (int64, error)
	TransferBalance(ctx context.Context, dto account.TransferBalanceDTO) (int64, int64, error)
}

type TransferBalanceRequest

type TransferBalanceRequest struct {
	SenderID   int64 `json:"sender_id"   binding:"required,gte=1"`
	ReceiverID int64 `json:"receiver_id" binding:"required,gte=1"`
	Amount     int64 `json:"amount"      binding:"required,gt=0"`
}

func (TransferBalanceRequest) ToDTO

type TransferBalanceResponse

type TransferBalanceResponse struct {
	SenderBalance   int64 `json:"sender_balance"`
	ReceiverBalance int64 `json:"receiver_balance"`
}

Jump to

Keyboard shortcuts

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