Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 30 for TX (0.2 sec)

  1. gorm.go

    func (db *DB) Debug() (tx *DB) {
    	tx = db.getInstance()
    	return tx.Session(&Session{
    		Logger: db.Logger.LogMode(logger.Info),
    	})
    }
    
    // Set store value with key into current db instance's context
    func (db *DB) Set(key string, value interface{}) *DB {
    	tx := db.getInstance()
    	tx.Statement.Settings.Store(key, value)
    	return tx
    }
    
    // Get get value with key from current db instance's context
    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)
  2. finisher_api.go

    	tx := db.getInstance().Set("rows", false)
    	tx = tx.callbacks.Row().Execute(tx)
    	row, ok := tx.Statement.Dest.(*sql.Row)
    	if !ok && tx.DryRun {
    		db.Logger.Error(tx.Statement.Context, ErrDryRunModeUnsupported.Error())
    	}
    	return row
    }
    
    func (db *DB) Rows() (*sql.Rows, error) {
    	tx := db.getInstance().Set("rows", true)
    	tx = tx.callbacks.Row().Execute(tx)
    	rows, ok := tx.Statement.Dest.(*sql.Rows)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  3. association.go

    		modelValue = reflect.New(association.Relationship.FieldSchema.ModelType).Interface()
    		tx         = association.DB.Model(modelValue)
    	)
    
    	if association.Relationship.JoinTable != nil {
    		if !tx.Statement.Unscoped && len(association.Relationship.JoinTable.QueryClauses) > 0 {
    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)
  4. tests/transaction_test.go

    	if err := tx.Save(&user1).Error; err != nil {
    		t.Fatalf("No error should raise, but got %v", err)
    	}
    
    	if err := tx.First(&User{}, "name = ?", user1.Name).Error; err != nil {
    		t.Fatalf("Should find saved record, but got %v", err)
    	}
    
    	if sqlTx, ok := tx.Statement.ConnPool.(gorm.TxCommitter); !ok || sqlTx == nil {
    		t.Fatalf("Should return the underlying sql.Tx")
    	}
    
    	tx.Rollback()
    
    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)
  5. chainable_api.go

    func (db *DB) Select(query interface{}, args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    
    	switch v := query.(type) {
    	case []string:
    		tx.Statement.Selects = v
    
    		for _, arg := range args {
    			switch arg := arg.(type) {
    			case string:
    				tx.Statement.Selects = append(tx.Statement.Selects, arg)
    			case []string:
    				tx.Statement.Selects = append(tx.Statement.Selects, arg...)
    			default:
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  6. tests/sql_builder_test.go

    	user.UpdatedAt = date
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Model(&User{}).Where("id = ?", 100).Updates(user)
    	})
    	assertEqualSQL(t, `UPDATE "users" SET "created_at"='2021-10-18 00:00:00',"updated_at"='2021-10-18 19:50:09.438',"name"='bar',"age"=22 WHERE id = 100 AND "users"."deleted_at" IS NULL`, sql)
    
    	// update
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Model(&User{}).Where("id = ?", 100).Update("name", "Foo bar")
    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)
  7. callbacks/preload.go

    	db.Statement.Settings.Range(func(k, v interface{}) bool {
    		tx.Statement.Settings.Store(k, v)
    		return true
    	})
    
    	if err := tx.Statement.Parse(dest); err != nil {
    		tx.AddError(err)
    		return tx
    	}
    	tx.Statement.ReflectValue = reflectValue
    	tx.Statement.Unscoped = db.Statement.Unscoped
    	return tx
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  8. tests/hooks_test.go

    	Owner string
    }
    
    func (s Product3) BeforeCreate(tx *gorm.DB) (err error) {
    	tx.Statement.SetColumn("Price", s.Price+100)
    	return nil
    }
    
    func (s Product3) BeforeUpdate(tx *gorm.DB) (err error) {
    	if tx.Statement.Changed() {
    		tx.Statement.SetColumn("Price", s.Price+10)
    	}
    
    	if tx.Statement.Changed("Code") {
    		s.Price += 20
    		tx.Statement.SetColumn("Price", s.Price+30)
    	}
    	return 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)
  9. callbacks/associations.go

    		tx = tx.Set("gorm:update_track_time", true)
    	}
    
    	if len(selects) > 0 {
    		tx = tx.Select(selects)
    	} else if restricted && len(omits) == 0 {
    		tx = tx.Omit(clause.Associations)
    	}
    
    	if len(omits) > 0 {
    		tx = tx.Omit(omits...)
    	}
    
    	return db.AddError(tx.Create(values).Error)
    }
    
    // check association values has been saved
    // if values kind is Struct, check it has been saved
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  10. tests/associations_has_many_test.go

    		Contents []ItemContent `gorm:"foreignKey:ItemID"`
    	}
    
    	tx := DB.Session(&gorm.Session{})
    	tx.Migrator().DropTable(&ItemContent{}, &Item{})
    	tx.AutoMigrate(&ItemContent{}, &Item{})
    
    	item := Item{
    		Logo: "logo",
    		Contents: []ItemContent{
    			{Name: "name", LanguageCode: "en"},
    			{Name: "ar name", LanguageCode: "ar"},
    		},
    	}
    	if err := tx.Create(&item).Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
Back to top