package async import "epur-pay/pkg/mq" type Async struct { Run func(a *Async, req AsyncRequest) Name string } type AsyncRequest struct { Data interface{} Chains []*mq.Task ChainErrorTriger bool Func func() Delay int64 } func NewAsyncRequest(data interface{}) AsyncRequest { return AsyncRequest{ Data: data, } } func NewAsyncRequestFunc(data func(), Delay int64) AsyncRequest { return AsyncRequest{ Func: data, Delay: Delay, } } type AsyncsModel struct { AfterCallback *Async } func (p *Async) Add(req AsyncRequest) { p.Run(p, req) }