fix UT and Sonar problem

This commit is contained in:
Ming Deng
2021-01-11 23:56:47 +08:00
parent be6a204232
commit deda13f3e4
6 changed files with 90 additions and 73 deletions

View File

@@ -20,7 +20,9 @@ import (
"github.com/beego/beego/v2/core/logs"
)
const mockCtxKey = "beego-orm-mock"
type mockCtxKeyType string
const mockCtxKey = mockCtxKeyType("beego-orm-mock")
func CtxWithMock(ctx context.Context, mock ...*Mock) context.Context {
return context.WithValue(ctx, mockCtxKey, mock)