Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 30 for statement (0.15 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 May 05 09:35:13 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 May 05 09:35:13 GMT 2024
    - Last Modified: Sat Dec 23 13:19:41 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  3. scan.go

    				if isArrayKind {
    					db.Statement.ReflectValue.Set(reflect.Zero(reflectValue.Type()))
    				} else {
    					// if the slice cap is externally initialized, the externally initialized slice is directly used here
    					if reflectValue.Cap() == 0 {
    						db.Statement.ReflectValue.Set(reflect.MakeSlice(reflectValue.Type(), 0, 20))
    					} else {
    						reflectValue.SetLen(0)
    						db.Statement.ReflectValue.Set(reflectValue)
    					}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  4. tests/count_test.go

    		t.Fatalf("Build count with select, but got %v", result.Statement.SQL.String())
    	}
    
    	result = dryDB.Table("users").Distinct("name").Count(&count)
    	if !regexp.MustCompile(`SELECT COUNT\(DISTINCT\(.name.\)\) FROM .*users.*`).MatchString(result.Statement.SQL.String()) {
    		t.Fatalf("Build count with select, but got %v", result.Statement.SQL.String())
    	}
    
    	var count4 int64
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  5. callbacks/helper_test.go

    				Values:  [][]interface{}{{true}},
    			},
    		},
    	}
    
    	for _, tc := range testCase {
    		t.Run(tc.name, func(t *testing.T) {
    			actual := ConvertMapToValuesForCreate(&gorm.Statement{}, tc.input)
    			if !reflect.DeepEqual(actual, tc.expect) {
    				t.Errorf("expect %v got %v", tc.expect, actual)
    			}
    		})
    	}
    }
    
    func TestConvertSliceOfMapToValuesForCreate(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 05 02:22:57 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  6. callbacks.go

    func (p *processor) Execute(db *DB) *DB {
    	// call scopes
    	for len(db.Statement.scopes) > 0 {
    		db = db.executeScopes()
    	}
    
    	var (
    		curTime           = time.Now()
    		stmt              = db.Statement
    		resetBuildClauses bool
    	)
    
    	if len(stmt.BuildClauses) == 0 {
    		stmt.BuildClauses = p.Clauses
    		resetBuildClauses = true
    	}
    
    	if optimizer, ok := db.Statement.Dest.(StatementModifier); ok {
    		optimizer.ModifyStatement(stmt)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  7. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  8. finisher_api.go

    					case string:
    						if field := db.Statement.Schema.LookUpField(column); field != nil {
    							db.AddError(field.Set(db.Statement.Context, db.Statement.ReflectValue, eq.Value))
    						}
    					case clause.Column:
    						if field := db.Statement.Schema.LookUpField(column.Name); field != nil {
    							db.AddError(field.Set(db.Statement.Context, db.Statement.ReflectValue, eq.Value))
    						}
    					}
    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)
  9. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  10. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
Back to top