Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 41 for TX (0.14 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. 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)
  3. 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)
  4. tests/query_test.go

    		results    []User
    		totalBatch int
    	)
    
    	if result := DB.Table("users as u").Where("name = ?", users[0].Name).FindInBatches(&results, 2, func(tx *gorm.DB, batch int) error {
    		totalBatch += batch
    
    		if tx.RowsAffected != 2 {
    			t.Errorf("Incorrect affected rows, expects: 2, got %v", tx.RowsAffected)
    		}
    
    		if len(results) != 2 {
    			t.Errorf("Incorrect users length, expects: 2, got %v", len(results))
    		}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
  5. 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 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  6. 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)
  7. cmd/perf-tests.go

    	if delta < 0 {
    		rx = 0
    		errStr = "network disconnection issues detected"
    	}
    
    	globalNetPerfRX.Reset()
    	return madmin.NetperfNodeResult{Endpoint: "", TX: r.n / uint64(duration.Seconds()), RX: uint64(rx / delta.Seconds()), Error: errStr}
    }
    
    func siteNetperf(ctx context.Context, duration time.Duration) madmin.SiteNetPerfNodeResult {
    	r := &netperfReader{eof: make(chan struct{})}
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sun Jan 28 18:04:17 GMT 2024
    - 11.3K bytes
    - Viewed (0)
  8. 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)
  9. callbacks/callmethod.go

    package callbacks
    
    import (
    	"reflect"
    
    	"gorm.io/gorm"
    )
    
    func callMethod(db *gorm.DB, fc func(value interface{}, tx *gorm.DB) bool) {
    	tx := db.Session(&gorm.Session{NewDB: true})
    	if called := fc(db.Statement.ReflectValue.Interface(), tx); !called {
    		switch db.Statement.ReflectValue.Kind() {
    		case reflect.Slice, reflect.Array:
    			db.Statement.CurDestIndex = 0
    			for i := 0; i < db.Statement.ReflectValue.Len(); i++ {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  10. 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)
Back to top