Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 54 for Case (0.31 sec)

  1. schema/utils.go

    			if _, isZero := rel.Field.ValueOf(ctx, value); !isZero {
    				result := reflect.Indirect(rel.Field.ReflectValueOf(ctx, value))
    				switch result.Kind() {
    				case reflect.Struct:
    					reflectResults = reflect.Append(reflectResults, result.Addr())
    				case reflect.Slice, reflect.Array:
    					for i := 0; i < result.Len(); i++ {
    						if elem := result.Index(i); elem.Kind() == reflect.Ptr {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  2. tests/scanner_valuer_test.go

    	// prepend asterisks
    	return append([]byte("***"), data...), nil
    }
    
    type Num int64
    
    func (i *Num) Scan(src interface{}) error {
    	switch s := src.(type) {
    	case []byte:
    		n, _ := strconv.Atoi(string(s))
    		*i = Num(n)
    	case int64:
    		*i = Num(s)
    	default:
    		return errors.New("Cannot scan NamedInt from " + reflect.ValueOf(src).String())
    	}
    	return nil
    }
    
    type StringsSlice []string
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K 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() {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  4. clause/group_by_test.go

    			}},
    			"SELECT * FROM `users` GROUP BY `role`,`gender` HAVING `role` = ? AND `gender` <> ?",
    			[]interface{}{"admin", "U"},
    		},
    	}
    
    	for idx, result := range results {
    		t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
    			checkBuildClauses(t, result.Clauses, result.Result, result.Vars)
    		})
    	}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.1K bytes
    - Viewed (0)
  5. clause/from_test.go

    				},
    			},
    			"SELECT * FROM `users` INNER JOIN `articles` ON `articles`.`id` = `users`.`id` LEFT JOIN `companies` USING (`company_name`)", nil,
    		},
    	}
    
    	for idx, result := range results {
    		t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
    			checkBuildClauses(t, result.Clauses, result.Result, result.Vars)
    		})
    	}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jul 15 02:25:10 GMT 2020
    - 1.9K bytes
    - Viewed (0)
  6. clause/where_test.go

    					}),
    				}}},
    			"SELECT * FROM `users` WHERE NOT ((`users`.`id` = ? AND `age` > ?) OR `score` < ?)",
    			[]interface{}{"1", 18, 100},
    		},
    	}
    
    	for idx, result := range results {
    		t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
    			checkBuildClauses(t, result.Clauses, result.Result, result.Vars)
    		})
    	}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  7. tests/helper_test.go

    				"Birthday", "CompanyID", "ManagerID", "Active")
    		}
    	})
    }
    
    func tidbSkip(t *testing.T, reason string) {
    	if isTiDB() {
    		t.Skipf("This test case skipped, because of TiDB '%s'", reason)
    	}
    }
    
    func isTiDB() bool {
    	return os.Getenv("GORM_DIALECT") == "tidb"
    }
    
    func isMysql() bool {
    	return os.Getenv("GORM_DIALECT") == "mysql"
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  8. tests/transaction_test.go

    	if err := DB.First(&User{}, "name = ?", "transaction-2").Error; err != nil {
    		t.Fatalf("Should be able to find committed record, but got %v", err)
    	}
    
    	t.Run("this is test nested transaction and prepareStmt coexist case", func(t *testing.T) {
    		// enable prepare statement
    		tx3 := DB.Session(&gorm.Session{PrepareStmt: true})
    		if err := tx3.Transaction(func(tx4 *gorm.DB) error {
    			// nested transaction
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  9. statement.go

    			}
    		case clause.Interface:
    			c := clause.Clause{Name: v.Name()}
    			v.MergeClause(&c)
    			c.Build(stmt)
    		case clause.Expression:
    			v.Build(stmt)
    		case driver.Valuer:
    			stmt.Vars = append(stmt.Vars, v)
    			stmt.DB.Dialector.BindVarTo(writer, stmt, v)
    		case []byte:
    			stmt.Vars = append(stmt.Vars, v)
    			stmt.DB.Dialector.BindVarTo(writer, stmt, v)
    		case []interface{}:
    			if len(v) > 0 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  10. callbacks/preload.go

    	switch reflectValue.Kind() {
    	case reflect.Struct:
    		switch rel.Type {
    		case schema.HasMany, schema.Many2Many:
    			tx.AddError(rel.Field.Set(tx.Statement.Context, reflectValue, reflect.MakeSlice(rel.Field.IndirectFieldType, 0, 10).Interface()))
    		default:
    			tx.AddError(rel.Field.Set(tx.Statement.Context, reflectValue, reflect.New(rel.Field.FieldType).Interface()))
    		}
    	case reflect.Slice, reflect.Array:
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
Back to top