Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for conj (0.19 sec)

  1. tests/connpool_test.go

    		},
    	}
    
    	defer func() {
    		if !reflect.DeepEqual(conn.got, conn.expect) {
    			t.Errorf("expect %#v but got %#v", conn.expect, conn.got)
    		}
    	}()
    
    	db, err := gorm.Open(mysql.New(mysql.Config{Conn: conn, DisableWithReturning: true}))
    	if err != nil {
    		t.Fatalf("Should open db success, but got %v", err)
    	}
    
    	tx := db.Begin()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  2. tests/prepared_stmt_test.go

    			tx.Create(&user)
    
    			var result User
    			tx.First(&result)
    			wg.Done()
    		}()
    	}
    	wg.Wait()
    
    	conn, ok := tx.ConnPool.(*gorm.PreparedStmtDB)
    	AssertEqual(t, ok, true)
    	AssertEqual(t, len(conn.Stmts), 2)
    	for _, stmt := range conn.Stmts {
    		if stmt == nil {
    			t.Fatalf("stmt cannot bee nil")
    		}
    	}
    
    	AssertEqual(t, sqlDB.Stats().InUse, 0)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  3. callbacks/delete.go

    							selects = append(selects, strings.TrimPrefix(s, columnPrefix))
    						}
    					}
    
    					if len(selects) > 0 {
    						tx = tx.Select(selects)
    					}
    				}
    
    				for _, cond := range queryConds {
    					if c, ok := cond.(clause.IN); ok && len(c.Values) == 0 {
    						withoutConditions = true
    						break
    					}
    				}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  4. finisher_api.go

    	if db.Error != nil {
    		return db.Error
    	}
    
    	tx := db.getInstance()
    	sqlDB, err := tx.DB()
    	if err != nil {
    		return
    	}
    
    	conn, err := sqlDB.Conn(tx.Statement.Context)
    	if err != nil {
    		return
    	}
    
    	defer conn.Close()
    	tx.Statement.ConnPool = conn
    	return fc(tx)
    }
    
    // Transaction start a transaction as a block, return error will rollback, otherwise to commit. Transaction executes an
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  5. prepare_stmt.go

    	// 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.
    	// 3. g1 tx exec insert, wait for unlock `conn.PrepareContext(ctx, query)` to finish tx and 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)
  6. tests/transaction_test.go

    		return nil
    	}); err == nil {
    		t.Errorf("should returns error when commit with closed conn, got error %v", err)
    	}
    
    	if err := DB.Session(&gorm.Session{PrepareStmt: true}).Transaction(func(tx *gorm.DB) error {
    		return nil
    	}); err == nil {
    		t.Errorf("should returns error when commit with closed conn, got error %v", err)
    	}
    }
    
    func TestTransactionWithHooks(t *testing.T) {
    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)
  7. chainable_api.go

    	tx = db.getInstance()
    	var whereConds []interface{}
    
    	for _, cond := range conds {
    		if c, ok := cond.(clause.Interface); ok {
    			tx.Statement.AddClause(c)
    		} else if optimizer, ok := cond.(StatementModifier); ok {
    			optimizer.ModifyStatement(tx.Statement)
    		} else {
    			whereConds = append(whereConds, cond)
    		}
    	}
    
    	if len(whereConds) > 0 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  8. tests/scopes_test.go

    						return d.Where(DB.Or("b = 2").Or("c = 3"))
    					},
    				).Find(&Language{})
    			},
    			expected: `SELECT * FROM "languages" WHERE a = 1 AND (b = 2 OR c = 3)`,
    		}, {
    			name: "depth_1_pre_cond",
    			queryFn: func(tx *gorm.DB) *gorm.DB {
    				return tx.Where("z = 0").Scopes(
    					func(d *gorm.DB) *gorm.DB { return d.Where("a = 1") },
    					func(d *gorm.DB) *gorm.DB {
    						return d.Or(DB.Where("b = 2").Or("c = 3"))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  9. callbacks/preload.go

    	column, values := schema.ToQueryValues(clause.CurrentTable, relForeignKeys, foreignValues)
    
    	if len(values) != 0 {
    		for _, cond := range conds {
    			if fc, ok := cond.(func(*gorm.DB) *gorm.DB); ok {
    				tx = fc(tx)
    			} else {
    				inlineConds = append(inlineConds, cond)
    			}
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  10. interfaces.go

    	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 {
    	BeginTx(ctx context.Context, opts *sql.TxOptions) (ConnPool, error)
    }
    
    // TxCommitter tx committer
    type TxCommitter interface {
    	Commit() error
    	Rollback() error
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:33:31 GMT 2023
    - 2.2K bytes
    - Viewed (0)
Back to top