Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for valueOf (0.25 sec)

  1. scan.go

    			mapValue[column] = reflectValue.Interface()
    			if valuer, ok := mapValue[column].(driver.Valuer); ok {
    				mapValue[column], _ = valuer.Value()
    			} else if b, ok := mapValue[column].(sql.RawBytes); ok {
    				mapValue[column] = string(b)
    			}
    		} else {
    			mapValue[column] = nil
    		}
    	}
    }
    
    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)
  2. callbacks/associations.go

    		tx = tx.Omit(omits...)
    	}
    
    	return db.AddError(tx.Create(values).Error)
    }
    
    // check association values has been saved
    // if values kind is Struct, check it has been saved
    // if values kind is Slice/Array, check all items have been saved
    var visitMapStoreKey = "gorm:saved_association_map"
    
    func checkAssociationsSaved(db *gorm.DB, values reflect.Value) bool {
    	if visit, ok := db.Get(visitMapStoreKey); ok {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  3. callbacks/create.go

    					values.Columns = append(values.Columns, clause.Column{Name: field.DBName})
    					for idx := range values.Values {
    						if vs[idx] == nil {
    							values.Values[idx] = append(values.Values[idx], stmt.DefaultValueOf(field))
    						} else {
    							values.Values[idx] = append(values.Values[idx], vs[idx])
    						}
    					}
    				}
    			}
    		case reflect.Struct:
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  4. finisher_api.go

    	default:
    		tx = db.getInstance()
    		tx.Statement.Dest = value
    		tx = tx.callbacks.Create().Execute(tx)
    	}
    	return
    }
    
    // Save updates value in database. If value doesn't contain a matching primary key, value is inserted.
    func (db *DB) Save(value interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Dest = value
    
    	reflectValue := reflect.Indirect(reflect.ValueOf(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)
  5. callbacks/query.go

    			var conds []clause.Expression
    			for _, primaryField := range db.Statement.Schema.PrimaryFields {
    				if v, isZero := primaryField.ValueOf(db.Statement.Context, db.Statement.ReflectValue); !isZero {
    					conds = append(conds, clause.Eq{Column: clause.Column{Table: db.Statement.Table, Name: primaryField.DBName}, Value: v})
    				}
    			}
    
    			if len(conds) > 0 {
    				db.Statement.AddClause(clause.Where{Exprs: conds})
    			}
    		}
    
    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)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. callbacks/preload.go

    	column, values := schema.ToQueryValues(clause.CurrentTable, relForeignKeys, foreignValues)
    
    	if len(values) != 0 {
    		for _, cond := range conds {
    			if fc, ok := cond.(func(*gorm.DB) *gorm.DB); ok {
    				tx = fc(tx)
    			} else {
    				inlineConds = append(inlineConds, cond)
    			}
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
Back to top