Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 20 for records (0.17 sec)

  1. tests/transaction_test.go

    		t.Fatalf("Should find saved record")
    	}
    
    	if err := DB.First(&User{}, "name = ?", user1.Name).Error; err == nil {
    		t.Fatalf("Should not find rollbacked record")
    	}
    
    	if err := DB.First(&User{}, "name = ?", user2.Name).Error; err != nil {
    		t.Fatalf("Should find saved record")
    	}
    }
    
    func TestNestedTransactionWithBlock(t *testing.T) {
    	var (
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  2. prepare_stmt.go

    	db.Stmts[query] = &cacheStmt
    	db.Mux.Unlock()
    
    	// prepare completed
    	defer close(cacheStmt.prepared)
    
    	// Reason why cannot lock conn.PrepareContext
    	// suppose the maxopen is 1, g1 is creating record and g2 is querying record.
    	// 1. g1 begin tx, g1 is requeue because of waiting for the system call, now `db.ConnPool` db.numOpen == 1.
    	// 2. g2 select lock `conn.PrepareContext(ctx, query)`, now db.numOpen == db.maxOpen , wait for release.
    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/scanner_valuer_test.go

    		ExampleStructPtr: &ExampleStruct{"name", "value2"},
    	}
    
    	var result ScannerValuerStruct
    	tx := DB.Where(data).FirstOrCreate(&result)
    
    	if tx.RowsAffected != 1 {
    		t.Errorf("RowsAffected should be 1 after create some record")
    	}
    
    	if tx.Error != nil {
    		t.Errorf("Should not raise any error, but got %v", tx.Error)
    	}
    
    	AssertObjEqual(t, result, data, "Name", "Gender", "Age")
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  4. tests/query_test.go

    	if len(results) != 1 {
    		t.Fatalf("Search all records with inline map")
    	}
    
    	CheckUser(t, results[0], users[2])
    
    	var results2 []User
    	DB.Find(&results2, map[string]interface{}{"name": users[3].Name, "company_id": nil})
    	if len(results2) != 0 {
    		t.Errorf("Search all records with inline map containing null value finding 0 records")
    	}
    
    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)
  5. tests/sql_builder_test.go

    		count++
    	}
    	if count != 1 {
    		t.Errorf("Raw with Rows should find one record with name 3")
    	}
    
    	DB.Exec("update users set name=? where name in (?)", "jinzhu-raw", []string{user1.Name, user2.Name, user3.Name})
    	if DB.Where("name in (?)", []string{user1.Name, user2.Name, user3.Name}).First(&User{}).Error != gorm.ErrRecordNotFound {
    		t.Error("Raw sql to update records")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  6. tests/delete_test.go

    		t.Errorf("should raise record not found error, but got error %v", err)
    	}
    
    	var result3 UserWithDelete
    	if err := DB.Table("deleted_users").Unscoped().First(&result3, user.ID).Error; err != nil {
    		t.Fatalf("failed to find record, got error %v", err)
    	}
    
    	if err := DB.Table("deleted_users").Unscoped().Delete(&result).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 07:03:34 GMT 2023
    - 9.4K bytes
    - Viewed (0)
  7. tests/serializer_test.go

    		JobInfo: Job{
    			Title:    "programmer",
    			Number:   9920,
    			Location: "Shadyside",
    			IsIntern: false,
    		},
    		CustomSerializerString: "world",
    	}
    
    	// first time insert record
    	out := SerializerStruct{}
    	if err := DB.Assign(data).FirstOrCreate(&out).Error; err != nil {
    		t.Fatalf("failed to FirstOrCreate Assigned data, got error %v", err)
    	}
    
    	var result SerializerStruct
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 21 14:09:38 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  8. tests/error_translator_test.go

    	if err = db.AutoMigrate(&City{}); err != nil {
    		t.Fatalf("failed to migrate cities table, got error: %v", err)
    	}
    
    	err = db.Create(&City{Name: "Kabul"}).Error
    	if err != nil {
    		t.Fatalf("failed to create record: %v", err)
    	}
    
    	err = db.Create(&City{Name: "Kabul"}).Error
    	if !errors.Is(err, gorm.ErrDuplicatedKey) {
    		t.Fatalf("expected err: %v got err: %v", gorm.ErrDuplicatedKey, err)
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 12 13:21:22 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  9. schema/field.go

    	// In some db (e.g. MySQL), Unique and UniqueIndex are indistinguishable.
    	// When a column has a (not Mul) UniqueIndex, Migrator always reports its gorm.ColumnType is Unique.
    	// It causes field unnecessarily migration.
    	// Therefore, we need to record the UniqueIndex on this column (exclude Mul UniqueIndex) for MigrateColumnUnique.
    	UniqueIndex string
    }
    
    func (field *Field) BindName() string {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  10. association.go

    	if association.Error == nil {
    		reflectValue := association.DB.Statement.ReflectValue
    		rel := association.Relationship
    
    		var oldBelongsToExpr clause.Expression
    		// we have to record the old BelongsTo value
    		if association.Unscope && rel.Type == schema.BelongsTo {
    			var foreignFields []*schema.Field
    			for _, ref := range rel.References {
    				if !ref.OwnPrimaryKey {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
Back to top