service

package
v0.0.0-...-3a05b22 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.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 BankService

type BankService struct {
	Money map[int]int
}

func GetBankServiceSingleton

func GetBankServiceSingleton() (*BankService, error)

func InitBankService

func InitBankService(b *BankService) (*BankService, error)

func (*BankService) AddMoney

func (b *BankService) AddMoney(id, num int) error

func (*BankService) AddMoneyRollback

func (b *BankService) AddMoneyRollback(id, num int, errMsg string)

func (*BankService) GetMoney

func (b *BankService) GetMoney(id int) int

func (*BankService) RemoveMoney

func (b *BankService) RemoveMoney(id, num int) error

func (*BankService) RemoveMoneyRollback

func (b *BankService) RemoveMoneyRollback(id, num int, errMsg string)

type BankServiceConstructFunc

type BankServiceConstructFunc func(impl *BankService) (*BankService, error)

type BankServiceIOCInterface

type BankServiceIOCInterface interface {
	GetMoney(id int) int
	AddMoney(id, num int) error
	AddMoneyRollback(id, num int, errMsg string)
	RemoveMoney(id, num int) error
	RemoveMoneyRollback(id, num int, errMsg string)
}

func GetBankServiceIOCInterfaceSingleton

func GetBankServiceIOCInterfaceSingleton() (BankServiceIOCInterface, error)

type ThisBankService

type ThisBankService struct {
}

func (*ThisBankService) This

type ThisTradeService

type ThisTradeService struct {
}

func (*ThisTradeService) This

type TradeService

type TradeService struct {
	BankService BankServiceIOCInterface `singleton:""`
}

func GetTradeServiceSingleton

func GetTradeServiceSingleton() (*TradeService, error)

func (*TradeService) DoTradeWithTxAddMoneyFailed

func (b *TradeService) DoTradeWithTxAddMoneyFailed(id1, id2, num int) error

func (*TradeService) DoTradeWithTxFinallyFailed

func (b *TradeService) DoTradeWithTxFinallyFailed(id1, id2, num int) error

func (*TradeService) DoTradeWithTxSuccess

func (b *TradeService) DoTradeWithTxSuccess(id1, id2, num int) error

type TradeServiceIOCInterface

type TradeServiceIOCInterface interface {
	DoTradeWithTxAddMoneyFailed(id1, id2, num int) error
	DoTradeWithTxFinallyFailed(id1, id2, num int) error
	DoTradeWithTxSuccess(id1, id2, num int) error
}

func GetTradeServiceIOCInterfaceSingleton

func GetTradeServiceIOCInterfaceSingleton() (TradeServiceIOCInterface, error)

Jump to

Keyboard shortcuts

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