Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 50 for statement (0.33 sec)

  1. statement.go

    			subdb := v.Session(&Session{Logger: logger.Discard, DryRun: true}).getInstance()
    			if v.Statement.SQL.Len() > 0 {
    				var (
    					vars = subdb.Statement.Vars
    					sql  = v.Statement.SQL.String()
    				)
    
    				subdb.Statement.Vars = make([]interface{}, 0, len(vars))
    				for _, vv := range vars {
    					subdb.Statement.Vars = append(subdb.Statement.Vars, vv)
    					bindvar := strings.Builder{}
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  2. statement_test.go

    	"testing"
    
    	"gorm.io/gorm/clause"
    )
    
    func TestWhereCloneCorruption(t *testing.T) {
    	for whereCount := 1; whereCount <= 8; whereCount++ {
    		t.Run(fmt.Sprintf("w=%d", whereCount), func(t *testing.T) {
    			s := new(Statement)
    			for w := 0; w < whereCount; w++ {
    				s = s.clone()
    				s.AddClause(clause.Where{
    					Exprs: s.BuildCondition(fmt.Sprintf("where%d", w)),
    				})
    			}
    
    			s1 := s.clone()
    			s1.AddClause(clause.Where{
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Dec 23 13:19:41 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  3. callbacks/callmethod.go

    	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++ {
    				if value := reflect.Indirect(db.Statement.ReflectValue.Index(i)); value.CanAddr() {
    					fc(value.Addr().Interface(), tx)
    				} else {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  4. tests/scanner_valuer_test.go

    		Name  string
    		Point Point
    	}
    
    	dryRunDB := DB.Session(&gorm.Session{DryRun: true})
    
    	stmt := dryRunDB.Create(&UserWithPoint{
    		Name:  "jinzhu",
    		Point: Point{X: 100, Y: 100},
    	}).Statement
    
    	if stmt.SQL.String() == "" || len(stmt.Vars) != 2 {
    		t.Errorf("Failed to generate sql, got %v", stmt.SQL.String())
    	}
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  5. callbacks/query.go

    			db.Statement.AddClause(c)
    		}
    	}
    
    	if db.Statement.SQL.Len() == 0 {
    		db.Statement.SQL.Grow(100)
    		clauseSelect := clause.Select{Distinct: db.Statement.Distinct}
    
    		if db.Statement.ReflectValue.Kind() == reflect.Struct && db.Statement.ReflectValue.Type() == db.Statement.Schema.ModelType {
    			var conds []clause.Expression
    			for _, primaryField := range db.Statement.Schema.PrimaryFields {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  6. callbacks/associations.go

    					if _, zero := rel.Field.ValueOf(db.Statement.Context, db.Statement.ReflectValue); !zero {
    						rv := rel.Field.ReflectValueOf(db.Statement.Context, db.Statement.ReflectValue) // relation reflect value
    						if rv.Kind() != reflect.Ptr {
    							rv = rv.Addr()
    						}
    
    						if saveAssociations(db, rel, rv, selectColumns, restricted, nil) == nil {
    							setupReferences(db.Statement.ReflectValue, rv)
    						}
    					}
    				}
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  7. chainable_api.go

    			j := join{
    				Name: query, Conds: args, Selects: db.Statement.Selects,
    				Omits: db.Statement.Omits, JoinType: joinType,
    			}
    			if where, ok := db.Statement.Clauses["WHERE"].Expression.(clause.Where); ok {
    				j.On = &where
    			}
    			tx.Statement.Joins = append(tx.Statement.Joins, j)
    			return
    		}
    	}
    
    	tx.Statement.Joins = append(tx.Statement.Joins, join{Name: query, Conds: args, JoinType: joinType})
    	return
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  8. tests/transaction_test.go

    		// enable prepare statement
    		tx3 := DB.Session(&gorm.Session{PrepareStmt: true})
    		if err := tx3.Transaction(func(tx4 *gorm.DB) error {
    			// nested transaction
    			return tx4.Transaction(func(tx5 *gorm.DB) error {
    				return tx5.First(&User{}, "name = ?", "transaction-2").Error
    			})
    		}); err != nil {
    			t.Fatalf("prepare statement and nested transcation coexist" + err.Error())
    		}
    	})
    }
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  9. migrator/migrator.go

    	GormDBDataType(*gorm.DB, *schema.Field) string
    }
    
    // RunWithValue run migration with statement value
    func (m Migrator) RunWithValue(value interface{}, fc func(*gorm.Statement) error) error {
    	stmt := &gorm.Statement{DB: m.DB}
    	if m.DB.Statement != nil {
    		stmt.Table = m.DB.Statement.Table
    		stmt.TableExpr = m.DB.Statement.TableExpr
    	}
    
    	if table, ok := value.(string); ok {
    		stmt.Table = table
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 28.5K bytes
    - Viewed (0)
  10. callbacks/update.go

    	if db.Error == nil && db.Statement.Schema != nil {
    		if !db.Statement.ReflectValue.CanAddr() || db.Statement.Model != db.Statement.Dest {
    			db.Statement.ReflectValue = reflect.ValueOf(db.Statement.Model)
    			for db.Statement.ReflectValue.Kind() == reflect.Ptr {
    				db.Statement.ReflectValue = db.Statement.ReflectValue.Elem()
    			}
    
    			if dest, ok := db.Statement.Dest.(map[string]interface{}); ok {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
Back to top