Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for Hafner (0.22 sec)

  1. tests/transaction_test.go

    		t.Fatalf("Should return the underlying sql.Tx")
    	}
    
    	tx.Rollback()
    
    	if err := DB.First(&User{}, "name = ?", "transaction").Error; err == nil {
    		t.Fatalf("Should not find record after rollback, but got %v", err)
    	}
    
    	txDB := DB.Where("fake_name = ?", "fake_name")
    	tx2 := txDB.Session(&gorm.Session{NewDB: true}).Begin()
    	user2 := *GetUser("transaction-2", Config{})
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  2. tests/update_test.go

    		t.Fatalf("user's updated at should be changed after reload, expects: %+v, got: %+v", user1UpdatedAt, result.UpdatedAt)
    	}
    
    	DB.First(&user2)
    	if user2UpdatedAt.Format(time.RFC1123Z) == user2.UpdatedAt.Format(time.RFC1123Z) {
    		t.Fatalf("user2's updated at should be changed after reload, expects: %+v, got: %+v", user2UpdatedAt, user2.UpdatedAt)
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K 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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  4. tests/hooks_test.go

    	}
    
    	p4 := Product{Code: "after_save_error", Price: 100}
    	DB.Save(&p4)
    	if err := DB.First(&Product{}, "code = ?", "after_save_error").Error; err == nil {
    		t.Fatalf("Record should be reverted if get an error in after save callback")
    	}
    
    	p5 := Product{Code: "after_delete_error", Price: 100}
    	DB.Save(&p5)
    	if err := DB.First(&Product{}, "code = ?", "after_delete_error").Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  5. callbacks/query.go

    		}
    
    		db.AddError(preloadEntryPoint(tx, joins, &tx.Statement.Schema.Relationships, db.Statement.Preloads, db.Statement.Preloads[clause.Associations]))
    	}
    }
    
    func AfterQuery(db *gorm.DB) {
    	// clear the joins after query because preload need it
    	db.Statement.Joins = nil
    	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && db.Statement.Schema.AfterFind && db.RowsAffected > 0 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  6. tests/multi_primary_keys_test.go

    		t.Fatalf("Blog should has three tags after Append")
    	}
    
    	if DB.Model(&blog).Association("SharedTags").Count() != 3 {
    		t.Fatalf("Blog should has three tags after Append")
    	}
    
    	if DB.Model(&blog2).Association("SharedTags").Count() != 3 {
    		t.Fatalf("Blog should has three tags after Append")
    	}
    
    	var tags []Tag
    	DB.Model(&blog).Association("SharedTags").Find(&tags)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
  7. tests/associations_many2many_test.go

    	}
    	AssertAssociationCount(t, user2, "Languages", 1, "after delete non-existing data")
    
    	if err := DB.Model(&user2).Association("Languages").Delete(&language2); err != nil {
    		t.Fatalf("Error happened when delete Languages, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Languages", 0, "after delete")
    
    	// Prepare Data for Clear
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 13.2K bytes
    - Viewed (0)
  8. tests/sql_builder_test.go

    		return tx.Model(&User{}).Where("id = ?", 100).Limit(10).Order("age desc").Find(&[]User{})
    	})
    	assertEqualSQL(t, `SELECT * FROM "users" WHERE id = 100 AND "users"."deleted_at" IS NULL ORDER BY age desc LIMIT 10`, sql)
    
    	// after model changed
    	if DB.Statement.DryRun || DB.DryRun {
    		t.Fatal("Failed expect DB.DryRun and DB.Statement.ToSQL to be false")
    	}
    
    	if DB.Statement.SQL.String() != "" {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  9. gorm.go

    	cacheStore *sync.Map
    }
    
    // Apply update config to new config
    func (c *Config) Apply(config *Config) error {
    	if config != c {
    		*config = *c
    	}
    	return nil
    }
    
    // AfterInitialize initialize plugins after db connected
    func (c *Config) AfterInitialize(db *DB) error {
    	if db != nil {
    		for _, plugin := range c.Plugins {
    			if err := plugin.Initialize(db); err != nil {
    				return err
    			}
    		}
    	}
    	return nil
    }
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  10. association.go

    func (association *Association) saveAssociation(clear bool, values ...interface{}) {
    	var (
    		reflectValue = association.DB.Statement.ReflectValue
    		assignBacks  []assignBack // assign association values back to arguments after save
    	)
    
    	appendToRelations := func(source, rv reflect.Value, clear bool) {
    		switch association.Relationship.Type {
    		case schema.HasOne, schema.BelongsTo:
    			switch rv.Kind() {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
Back to top