Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for IsValid (0.17 sec)

  1. logger/sql.go

    				} else {
    					vars[idx] = escaper + v.Format(tmFmtWithMS) + escaper
    				}
    			} else {
    				vars[idx] = nullStr
    			}
    		case driver.Valuer:
    			reflectValue := reflect.ValueOf(v)
    			if v != nil && reflectValue.IsValid() && ((reflectValue.Kind() == reflect.Ptr && !reflectValue.IsNil()) || reflectValue.Kind() != reflect.Ptr) {
    				r, _ := v.Value()
    				convertParams(r, idx)
    			} else {
    				vars[idx] = nullStr
    			}
    		case fmt.Stringer:
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  2. utils/utils.go

    			results[idx] = v
    		case []byte:
    			results[idx] = string(v)
    		case uint:
    			results[idx] = strconv.FormatUint(uint64(v), 10)
    		default:
    			results[idx] = "nil"
    			vv := reflect.ValueOf(v)
    			if vv.IsValid() && !vv.IsZero() {
    				results[idx] = fmt.Sprint(reflect.Indirect(vv).Interface())
    			}
    		}
    	}
    
    	return strings.Join(results, "_")
    }
    
    func Contains(elems []string, elem string) bool {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  3. utils/tests/utils.go

    )
    
    func AssertObjEqual(t *testing.T, r, e interface{}, names ...string) {
    	for _, name := range names {
    		rv := reflect.Indirect(reflect.ValueOf(r))
    		ev := reflect.Indirect(reflect.ValueOf(e))
    		if rv.IsValid() != ev.IsValid() {
    			t.Errorf("%v: expect: %+v, got %+v", utils.FileWithLineNum(), r, e)
    			return
    		}
    		got := rv.FieldByName(name).Interface()
    		expect := ev.FieldByName(name).Interface()
    		t.Run(name, func(t *testing.T) {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Mar 10 09:21:56 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  4. callbacks/query.go

    					clauseSelect.Columns = append(clauseSelect.Columns, clause.Column{Table: db.Statement.Table, Name: dbName})
    				}
    			}
    		} else if db.Statement.Schema != nil && db.Statement.ReflectValue.IsValid() {
    			queryFields := db.QueryFields
    			if !queryFields {
    				switch db.Statement.ReflectValue.Kind() {
    				case reflect.Struct:
    					queryFields = db.Statement.ReflectValue.Type() != db.Statement.Schema.ModelType
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  5. statement.go

    									}
    								}
    							}
    						}
    					}
    				}
    
    				if restricted {
    					break
    				}
    			} else if !reflectValue.IsValid() {
    				stmt.AddError(ErrInvalidData)
    			} else if len(conds) == 0 {
    				if len(args) == 1 {
    					switch reflectValue.Kind() {
    					case reflect.Slice, reflect.Array:
    						// optimize reflect value length
    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)
  6. callbacks/create.go

    			values.Values = make([][]interface{}, rValLen)
    
    			defaultValueFieldsHavingValue := map[*schema.Field][]interface{}{}
    			for i := 0; i < rValLen; i++ {
    				rv := reflect.Indirect(stmt.ReflectValue.Index(i))
    				if !rv.IsValid() {
    					stmt.AddError(fmt.Errorf("slice data #%v is invalid: %w", i, gorm.ErrInvalidData))
    					return
    				}
    
    				values.Values[i] = make([]interface{}, len(values.Columns))
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  7. schema/field.go

    	valuer, isValuer := fieldValue.Interface().(driver.Valuer)
    	if isValuer {
    		if _, ok := fieldValue.Interface().(GormDataTypeInterface); !ok {
    			if v, err := valuer.Value(); reflect.ValueOf(v).IsValid() && err == nil {
    				fieldValue = reflect.ValueOf(v)
    			}
    
    			// Use the field struct's first field type as data type, e.g: use `string` for sql.NullString
    			var getRealFieldValue func(reflect.Value)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  8. finisher_api.go

    		tx.AddError(err)
    	}
    	tx.Statement.Dest = dest
    	tx.Statement.ReflectValue = reflect.ValueOf(dest)
    	for tx.Statement.ReflectValue.Kind() == reflect.Ptr {
    		elem := tx.Statement.ReflectValue.Elem()
    		if !elem.IsValid() {
    			elem = reflect.New(tx.Statement.ReflectValue.Type().Elem())
    			tx.Statement.ReflectValue.Set(elem)
    		}
    		tx.Statement.ReflectValue = elem
    	}
    	Scan(rows, tx, ScanInitialized)
    	return tx.Error
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  9. schema/schema.go

    		callbackTypeBeforeDelete, callbackTypeAfterDelete,
    		callbackTypeAfterFind,
    	}
    	for _, cbName := range callbackTypes {
    		if methodValue := callBackToMethodValue(modelValue, cbName); methodValue.IsValid() {
    			switch methodValue.Type().String() {
    			case "func(*gorm.DB) error": // TODO hack
    				reflect.Indirect(reflect.ValueOf(schema)).FieldByName(string(cbName)).SetBool(true)
    			default:
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  10. scan.go

    }
    
    func scanIntoMap(mapValue map[string]interface{}, values []interface{}, columns []string) {
    	for idx, column := range columns {
    		if reflectValue := reflect.Indirect(reflect.Indirect(reflect.ValueOf(values[idx]))); reflectValue.IsValid() {
    			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 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
Back to top