Skip to content

Commit

Permalink
Merge branch 'v1.15.x' into feat/bind-config
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed3mar authored Feb 8, 2025
2 parents 9fd7def + 54f094e commit 18c71cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions database/orm/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
frameworkconfig "github.com/goravel/framework/config"
"github.com/goravel/framework/contracts/config"
contractsorm "github.com/goravel/framework/contracts/database/orm"
contractshttp "github.com/goravel/framework/contracts/http"
"github.com/goravel/framework/contracts/log"
"github.com/goravel/framework/database/factory"
"github.com/goravel/framework/database/gorm"
Expand Down Expand Up @@ -147,6 +148,10 @@ func (r *Orm) Transaction(txFunc func(tx contractsorm.Query) error) error {
}

func (r *Orm) WithContext(ctx context.Context) contractsorm.Orm {
if http, ok := ctx.(contractshttp.Context); ok {
ctx = http.Context()
}

for _, query := range r.queries {
if queryWithSetContext, ok := query.(contractsorm.QueryWithSetContext); ok {
queryWithSetContext.SetContext(ctx)
Expand Down

0 comments on commit 18c71cc

Please sign in to comment.