Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 53 for TX (0.16 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 14 09:35:11 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  2. 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 14 09:35:11 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  3. 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 14 09:35:11 GMT 2024
    - Last Modified: Sat Mar 09 13:27:19 GMT 2024
    - 11.3K bytes
    - Viewed (0)
  4. 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 14 09:35:11 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  5. tests/prepared_stmt_test.go

    	}
    
    	if err := tx.Where("name=?", "zzjin").Delete(&User{}).Error; err != nil {
    		tx.Rollback()
    		t.Errorf("Failed to run one transaction, got error %v\n", err)
    	}
    
    	if err := tx.Create(&User{Name: "zzjin"}).Error; err != nil {
    		tx.Rollback()
    		t.Errorf("Failed to run one transaction, got error %v\n", err)
    	}
    
    	if err := tx.Commit().Error; err != nil {
    Go
    - Registered: Sun Apr 14 09:35:11 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  6. interfaces.go

    }
    
    // SavePointerDialectorInterface save pointer interface
    type SavePointerDialectorInterface interface {
    	SavePoint(tx *DB, name string) error
    	RollbackTo(tx *DB, name string) error
    }
    
    // TxBeginner tx beginner
    type TxBeginner interface {
    	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
    }
    
    // ConnPoolBeginner conn pool beginner
    type ConnPoolBeginner interface {
    Go
    - Registered: Sun Apr 14 09:35:11 GMT 2024
    - Last Modified: Sat Aug 19 13:33:31 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  7. prepare_stmt.go

    		return tx.Tx.Rollback()
    	}
    	return ErrInvalidTransaction
    }
    
    func (tx *PreparedStmtTX) ExecContext(ctx context.Context, query string, args ...interface{}) (result sql.Result, err error) {
    	stmt, err := tx.PreparedStmtDB.prepare(ctx, tx.Tx, true, query)
    	if err == nil {
    		result, err = tx.Tx.StmtContext(ctx, stmt.Stmt).ExecContext(ctx, args...)
    		if errors.Is(err, driver.ErrBadConn) {
    Go
    - Registered: Sun Apr 14 09:35:11 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  8. 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 14 09:35:11 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  9. tests/connpool_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 14 09:35:11 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  10. 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 14 09:35:11 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
Back to top