You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
606 B

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)
}