summaryrefslogtreecommitdiffstats
path: root/models/db/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/db/context.go')
-rw-r--r--models/db/context.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/models/db/context.go b/models/db/context.go
index 0037bb198d..62b77bc72f 100644
--- a/models/db/context.go
+++ b/models/db/context.go
@@ -31,6 +31,14 @@ type Context struct {
e Engine
}
+// WithEngine returns a db.Context from a context.Context and db.Engine
+func WithEngine(ctx context.Context, e Engine) *Context {
+ return &Context{
+ Context: ctx,
+ e: e,
+ }
+}
+
// Engine returns db engine
func (ctx *Context) Engine() Engine {
return ctx.e