Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for Explain (0.32 sec)

  1. callbacks.go

    			sql, vars := stmt.SQL.String(), stmt.Vars
    			if filter, ok := db.Logger.(ParamsFilter); ok {
    				sql, vars = filter.ParamsFilter(stmt.Context, stmt.SQL.String(), stmt.Vars...)
    			}
    			return db.Dialector.Explain(sql, vars...), db.RowsAffected
    		}, db.Error)
    	}
    
    	if !stmt.DB.DryRun {
    		stmt.SQL.Reset()
    		stmt.Vars = nil
    	}
    
    	if resetBuildClauses {
    		stmt.BuildClauses = nil
    	}
    
    	return db
    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)
  2. migrator/migrator.go

    			defaultStmt := &gorm.Statement{Vars: []interface{}{field.DefaultValueInterface}}
    			m.Dialector.BindVarTo(defaultStmt, defaultStmt, field.DefaultValueInterface)
    			expr.SQL += " DEFAULT " + m.Dialector.Explain(defaultStmt.SQL.String(), field.DefaultValueInterface)
    		} else if field.DefaultValue != "(-)" {
    			expr.SQL += " DEFAULT " + field.DefaultValue
    		}
    	}
    
    	return
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  3. logger/sql_test.go

    		},
    	}
    
    	for idx, r := range results {
    		if result := logger.ExplainSQL(r.SQL, r.NumericRegexp, `"`, r.Vars...); result != r.Result {
    			t.Errorf("Explain SQL #%v expects %v, but got %v", idx, r.Result, result)
    		}
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  4. utils/tests/dummy_dialecter.go

    			}
    
    			writer.WriteByte(v)
    		}
    		shiftDelimiter++
    	}
    
    	if continuousBacktick > 0 && !selfQuoted {
    		writer.WriteString("``")
    	}
    	writer.WriteByte('`')
    }
    
    func (DummyDialector) Explain(sql string, vars ...interface{}) string {
    	return logger.ExplainSQL(sql, nil, `"`, vars...)
    }
    
    func (DummyDialector) DataTypeOf(*schema.Field) string {
    	return ""
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 06 06:03:31 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  5. interfaces.go

    	Migrator(db *DB) Migrator
    	DataTypeOf(*schema.Field) string
    	DefaultValueOf(*schema.Field) clause.Expression
    	BindVarTo(writer clause.Writer, stmt *Statement, v interface{})
    	QuoteTo(clause.Writer, string)
    	Explain(sql string, vars ...interface{}) string
    }
    
    // Plugin GORM plugin interface
    type Plugin interface {
    	Name() string
    	Initialize(*DB) error
    }
    
    type ParamsFilter interface {
    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)
  6. tests/sql_builder_test.go

    func (ageFloat) String() string {
    	return "age"
    }
    
    func TestExplainSQL(t *testing.T) {
    	user := *GetUser("explain-sql", Config{})
    	dryRunDB := DB.Session(&gorm.Session{DryRun: true})
    
    	stmt := dryRunDB.Model(&user).Where("id = ?", 1).Updates(map[string]interface{}{"age": ageInt(8)}).Statement
    	sql := DB.Dialector.Explain(stmt.SQL.String(), stmt.Vars...)
    	if !regexp.MustCompile(`.*age.*=8,`).MatchString(sql) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  7. gorm.go

    //				.First(&User{})
    //	})
    func (db *DB) ToSQL(queryFn func(tx *DB) *DB) string {
    	tx := queryFn(db.Session(&Session{DryRun: true, SkipDefaultTransaction: true}))
    	stmt := tx.Statement
    
    	return db.Dialector.Explain(stmt.SQL.String(), stmt.Vars...)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  8. tests/query_test.go

    	stmt := dryDB.Clauses(clause.OrderBy{
    		Expression: clause.Expr{SQL: "FIELD(id,?)", Vars: []interface{}{[]int{1, 2, 3}}, WithoutParentheses: true},
    	}).Find(&User{}).Statement
    
    	explainedSQL := dryDB.Dialector.Explain(stmt.SQL.String(), stmt.Vars...)
    	if !regexp.MustCompile("SELECT \\* FROM .*users.* ORDER BY FIELD\\(id,1,2,3\\)").MatchString(explainedSQL) {
    		t.Fatalf("Build Order condition, but got %v", explainedSQL)
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
Back to top