add func withcontext

添加 WithContext() 支持
This commit is contained in:
谢小军
2020-09-27 16:48:02 +08:00
parent 8eb31b7911
commit ef185ecb97
5 changed files with 69 additions and 45 deletions

View File

@@ -26,7 +26,19 @@ func (obj *_BaseMgr) SetTimeOut(timeout time.Duration) {
// SetCtx set context
func (obj *_BaseMgr) SetCtx(c context.Context) {
obj.ctx = c
if c != nil {
obj.ctx = c
}
}
// Ctx get context
func (obj *_BaseMgr) GetCtx() context.Context {
return obj.ctx
}
// Cancel cancel context
func (obj *_BaseMgr) Cancel(c context.Context) {
obj.cancel()
}
// GetDB get gorm.DB info