Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for Sait (0.57 sec)

  1. tests/prepared_stmt_test.go

    	for i := 0; i < 100; i++ {
    		wg.Add(1)
    		go func() {
    			user := User{Name: "jinzhu"}
    			tx.Create(&user)
    
    			var result User
    			tx.First(&result)
    			wg.Done()
    		}()
    	}
    	wg.Wait()
    
    	conn, ok := tx.ConnPool.(*gorm.PreparedStmtDB)
    	AssertEqual(t, ok, true)
    	AssertEqual(t, len(conn.Stmts), 2)
    	for _, stmt := range conn.Stmts {
    		if stmt == nil {
    			t.Fatalf("stmt cannot bee nil")
    		}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  2. prepare_stmt.go

    		db.Mux.RUnlock()
    		// wait for other goroutines prepared
    		<-stmt.prepared
    		if stmt.prepareErr != nil {
    			return Stmt{}, stmt.prepareErr
    		}
    
    		return *stmt, nil
    	}
    	db.Mux.RUnlock()
    
    	db.Mux.Lock()
    	// double check
    	if stmt, ok := db.Stmts[query]; ok && (!stmt.Transaction || isTransaction) {
    		db.Mux.Unlock()
    		// wait for other goroutines prepared
    		<-stmt.prepared
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  3. tests/preload_test.go

    			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) {
    	user := *GetUser("preload_with_diff_model", Config{Account: true})
    
    	if err := DB.Create(&user).Error; err != nil {
    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)
  4. schema/schema.go

    	} else {
    		schemaCacheKey = modelType
    	}
    
    	// Load exist schema cache, return if exists
    	if v, ok := cacheStore.Load(schemaCacheKey); ok {
    		s := v.(*Schema)
    		// Wait for the initialization of other goroutines to complete
    		<-s.initialized
    		return s, s.err
    	}
    
    	modelValue := reflect.New(modelType)
    	tableName := namer.TableName(modelType.Name())
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  5. tests/associations_many2many_test.go

    		wg.Add(1)
    		go func(user User, language Language) {
    			err := db.Model(&user).Association("Languages").Append(&language)
    			AssertEqual(t, err, nil)
    
    			wg.Done()
    		}(user, languages[i])
    	}
    	wg.Wait()
    
    	var find User
    	err = db.Preload(clause.Associations).Where("id = ?", user.ID).First(&find).Error
    	AssertEqual(t, err, nil)
    	AssertAssociationCount(t, find, "Languages", int64(count), "after concurrent append")
    }
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 13.2K bytes
    - Viewed (0)
Back to top