Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for KSession (0.2 sec)

  1. migrator/migrator.go

    		}
    	}
    
    	return
    }
    
    func (m Migrator) GetQueryAndExecTx() (queryTx, execTx *gorm.DB) {
    	queryTx = m.DB.Session(&gorm.Session{})
    	execTx = queryTx
    	if m.DB.DryRun {
    		queryTx.DryRun = false
    		execTx = m.DB.Session(&gorm.Session{Logger: &printSQLLogger{Interface: m.DB.Logger}})
    	}
    	return queryTx, execTx
    }
    
    // AutoMigrate auto migrate values
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  2. tests/preload_test.go

    func TestPreloadGoroutine(t *testing.T) {
    	var wg sync.WaitGroup
    
    	wg.Add(10)
    	for i := 0; i < 10; i++ {
    		go func() {
    			defer wg.Done()
    			var user2 []User
    			tx := DB.Where("id = ?", 1).Session(&gorm.Session{})
    
    			if err := tx.Preload("Team").Find(&user2).Error; err != nil {
    				t.Error(err)
    			}
    		}()
    	}
    	wg.Wait()
    }
    
    func TestPreloadWithDiffModel(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  3. callbacks/preload.go

    						return err
    					}
    				default:
    					return gorm.ErrInvalidData
    				}
    			} else {
    				tx := db.Table("").Session(&gorm.Session{Context: db.Statement.Context, SkipHooks: db.Statement.SkipHooks})
    				tx.Statement.ReflectValue = db.Statement.ReflectValue
    				tx.Statement.Unscoped = db.Statement.Unscoped
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  4. tests/query_test.go

    	result := DB.Session(&gorm.Session{DryRun: true}).Model(&User{}).Find(&simpleUsers, user.ID)
    
    	if !regexp.MustCompile("SELECT .*id.*name.*updated_at.*created_at.* FROM .*users").MatchString(result.Statement.SQL.String()) {
    		t.Fatalf("SQL should include selected names, but got %v", result.Statement.SQL.String())
    	}
    
    	result = DB.Session(&gorm.Session{DryRun: true}).Model(&User{}).Find(&User{}, user.ID)
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
Back to top