Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for AddClause (0.17 sec)

  1. statement_test.go

    			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{
    				Exprs: s.BuildCondition("FINAL1"),
    			})
    			s2 := s.clone()
    			s2.AddClause(clause.Where{
    				Exprs: s.BuildCondition("FINAL2"),
    			})
    
    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)
  2. callbacks/update.go

    				db.Statement.AddClause(c)
    			}
    		}
    
    		if db.Statement.SQL.Len() == 0 {
    			db.Statement.SQL.Grow(180)
    			db.Statement.AddClauseIfNotExists(clause.Update{})
    			if _, ok := db.Statement.Clauses["SET"]; !ok {
    				if set := ConvertToAssignments(db.Statement); len(set) != 0 {
    					defer delete(db.Statement.Clauses, "SET")
    					db.Statement.AddClause(set)
    				} else {
    					return
    				}
    			}
    
    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)
  3. chainable_api.go

    	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 {
    		tx.Statement.AddClause(clause.Where{Exprs: tx.Statement.BuildCondition(whereConds[0], whereConds[1:]...)})
    	}
    	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)
  4. soft_delete.go

    						where.Exprs = []clause.Expression{clause.And(where.Exprs...)}
    						c.Expression = where
    						stmt.Clauses["WHERE"] = c
    						break
    					}
    				}
    			}
    		}
    
    		stmt.AddClause(clause.Where{Exprs: []clause.Expression{
    			clause.Eq{Column: clause.Column{Table: clause.CurrentTable, Name: sd.Field.DBName}, Value: sd.ZeroValue},
    		}})
    		stmt.Clauses["soft_delete_enabled"] = clause.Clause{}
    	}
    }
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 4.5K bytes
    - Viewed (0)
  5. callbacks/delete.go

    	return func(db *gorm.DB) {
    		if db.Error != nil {
    			return
    		}
    
    		if db.Statement.Schema != nil {
    			for _, c := range db.Statement.Schema.DeleteClauses {
    				db.Statement.AddClause(c)
    			}
    		}
    
    		if db.Statement.SQL.Len() == 0 {
    			db.Statement.SQL.Grow(100)
    			db.Statement.AddClauseIfNotExists(clause.Delete{})
    
    			if db.Statement.Schema != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  6. callbacks/query.go

    								onStmt := gorm.Statement{Table: tableAliasName, DB: db, Clauses: map[string]clause.Clause{}}
    								for _, c := range relation.FieldSchema.QueryClauses {
    									onStmt.AddClause(c)
    								}
    
    								if join.On != nil {
    									onStmt.AddClause(join.On)
    								}
    
    								if cs, ok := onStmt.Clauses["WHERE"]; ok {
    									if where, ok := cs.Expression.(clause.Where); ok {
    										where.Build(&onStmt)
    
    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)
  7. clause/clause_test.go

    	)
    
    	for _, c := range clauses {
    		if _, ok := buildNamesMap[c.Name()]; !ok {
    			buildNames = append(buildNames, c.Name())
    			buildNamesMap[c.Name()] = true
    		}
    
    		stmt.AddClause(c)
    	}
    
    	stmt.Build(buildNames...)
    
    	if strings.TrimSpace(stmt.SQL.String()) != result {
    		t.Errorf("SQL expects %v got %v", result, stmt.SQL.String())
    	}
    
    	if !reflect.DeepEqual(stmt.Vars, vars) {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Jun 02 02:50:38 GMT 2020
    - 1012 bytes
    - Viewed (0)
  8. clause/benchmarks_test.go

    		for _, clause := range clauses {
    			stmt.AddClause(clause)
    		}
    
    		stmt.Build("SELECT", "FROM", "WHERE")
    		_ = stmt.SQL.String()
    	}
    }
    
    func BenchmarkComplexSelect(b *testing.B) {
    	user, _ := schema.Parse(&tests.User{}, &sync.Map{}, db.NamingStrategy)
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Oct 07 12:14:14 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  9. callbacks/create.go

    						fromColumns = append(fromColumns, clause.Column{Name: field.DBName})
    					}
    					db.Statement.AddClause(clause.Returning{Columns: fromColumns})
    				}
    			}
    		}
    
    		if db.Statement.SQL.Len() == 0 {
    			db.Statement.SQL.Grow(180)
    			db.Statement.AddClauseIfNotExists(clause.Insert{})
    			db.Statement.AddClause(ConvertToCreateValues(db.Statement))
    
    			db.Statement.Build(db.Statement.BuildClauses...)
    		}
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  10. finisher_api.go

    		Column: clause.Column{Table: clause.CurrentTable, Name: clause.PrimaryKey},
    	})
    	if len(conds) > 0 {
    		if exprs := tx.Statement.BuildCondition(conds[0], conds[1:]...); len(exprs) > 0 {
    			tx.Statement.AddClause(clause.Where{Exprs: exprs})
    		}
    	}
    	tx.Statement.RaiseErrorOnNotFound = true
    	tx.Statement.Dest = dest
    	return tx.callbacks.Query().Execute(tx)
    }
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
Back to top