Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 45 for valueOf (0.16 sec)

  1. clause/values_test.go

    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{
    				clause.Insert{},
    				clause.Values{
    					Columns: []clause.Column{{Name: "name"}, {Name: "age"}},
    					Values:  [][]interface{}{{"jinzhu", 18}, {"josh", 1}},
    				},
    			},
    			"INSERT INTO `users` (`name`,`age`) VALUES (?,?),(?,?)",
    			[]interface{}{"jinzhu", 18, "josh", 1},
    		},
    	}
    
    	for idx, result := range results {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 691 bytes
    - Viewed (0)
  2. tests/scanner_valuer_test.go

    	switch value := input.(type) {
    	case string:
    		return json.Unmarshal([]byte(value), l)
    	case []byte:
    		return json.Unmarshal(value, l)
    	default:
    		return errors.New("not supported")
    	}
    }
    
    type Role struct {
    	Name string `gorm:"size:256"`
    }
    
    func (role *Role) Scan(value interface{}) error {
    	if b, ok := value.([]uint8); ok {
    		role.Name = string(b)
    	} else {
    		role.Name = value.(string)
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  3. tests/connpool_test.go

    			"SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?",
    			"INSERT INTO `users` (`created_at`,`updated_at`,`deleted_at`,`name`,`age`,`birthday`,`company_id`,`manager_id`,`active`) VALUES (?,?,?,?,?,?,?,?,?)",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  4. tests/create_test.go

    	}
    
    	// case 3: records
    	values := []map[string]interface{}{
    		{"name": "create_from_map_with_schema11", "age": 1}, {"name": "create_from_map_with_schema12", "age": 1},
    	}
    
    	beforeLen := len(values)
    	if err := DB.Model(&User{}).Create(&values).Error; err != nil {
    		t.Fatalf("failed to create data from map, got error: %v", err)
    	}
    
    	// mariadb with returning, values will be appended with id map
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  5. tests/migrate_test.go

    						columnType)
    				}
    				if v, ok := columnType.DefaultValue(); !ok || v != "hello" {
    					t.Fatalf("column code default value should be correct, name: %v, column: %#v, default value: %v",
    						columnType.Name(), columnType, v)
    				}
    				if v, ok := columnType.Comment(); !ok || v != "my code2" {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  6. callbacks/update.go

    				}
    			}
    		case reflect.Struct:
    			for _, field := range stmt.Schema.PrimaryFields {
    				if value, isZero := field.ValueOf(stmt.Context, stmt.ReflectValue); !isZero {
    					stmt.AddClause(clause.Where{Exprs: []clause.Expression{clause.Eq{Column: field.DBName, Value: value}}})
    				}
    			}
    		}
    	}
    
    	switch value := updatingValue.Interface().(type) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  7. statement.go

    						values := make([]interface{}, valueLen)
    						for i := 0; i < valueLen; i++ {
    							values[i] = reflectValue.Index(i).Interface()
    						}
    
    						conds = append(conds, clause.IN{Column: key, Values: values})
    					}
    				default:
    					conds = append(conds, clause.Eq{Column: key, Value: v[key]})
    				}
    			}
    		default:
    			reflectValue := reflect.Indirect(reflect.ValueOf(arg))
    			for reflectValue.Kind() == reflect.Ptr {
    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)
  8. tests/preload_suits_test.go

    	want[0] = Level3{
    		Level2: Level2{
    			Level1s: []Level1{
    				{Value: "value1"},
    				{Value: "value2"},
    			},
    		},
    		Level2_1: Level2_1{
    			Level1s: []Level1{
    				{
    					Value:   "value1-1",
    					Level0s: []Level0{{Value: "Level0-1"}},
    				},
    				{
    					Value:   "value2-2",
    					Level0s: []Level0{{Value: "Level0-2"}},
    				},
    			},
    		},
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 18 05:38:46 GMT 2022
    - 30.3K bytes
    - Viewed (0)
  9. logger/sql_test.go

    	"github.com/jinzhu/now"
    	"gorm.io/gorm/logger"
    )
    
    type JSON json.RawMessage
    
    func (j JSON) Value() (driver.Value, error) {
    	if len(j) == 0 {
    		return nil, nil
    	}
    	return json.RawMessage(j).MarshalJSON()
    }
    
    type ExampleStruct struct {
    	Name string
    	Val  string
    }
    
    func (s ExampleStruct) Value() (driver.Value, error) {
    	return json.Marshal(s)
    }
    
    func format(v []byte, escaper string) string {
    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)
  10. errors.go

    	// ErrInvalidDB invalid db
    	ErrInvalidDB = errors.New("invalid db")
    	// ErrInvalidValue invalid value
    	ErrInvalidValue = errors.New("invalid value, should be pointer to struct or slice")
    	// ErrInvalidValueOfLength invalid values do not match length
    	ErrInvalidValueOfLength = errors.New("invalid association values, length doesn't match")
    	// ErrPreloadNotAllowed preload is not allowed when count is used
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 02:53:17 GMT 2024
    - 2.5K bytes
    - Viewed (0)
Back to top