Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 47 for field1 (0.18 sec)

  1. callbacks/preload.go

    				tx.AddError(rel.Field.Set(tx.Statement.Context, reflectValue.Index(i), reflect.MakeSlice(rel.Field.IndirectFieldType, 0, 10).Interface()))
    			default:
    				tx.AddError(rel.Field.Set(tx.Statement.Context, reflectValue.Index(i), reflect.New(rel.Field.FieldType).Interface()))
    			}
    		}
    	}
    
    	for i := 0; i < reflectResults.Len(); i++ {
    		elem := reflectResults.Index(i)
    		for idx, field := range relForeignFields {
    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)
  2. callbacks/update.go

    			}
    
    			if stmt.Schema != nil {
    				if field := stmt.Schema.LookUpField(k); field != nil {
    					if field.DBName != "" {
    						if v, ok := selectColumns[field.DBName]; (ok && v) || (!ok && !restricted) {
    							set = append(set, clause.Assignment{Column: clause.Column{Name: field.DBName}, Value: kv})
    							assignValue(field, value[k])
    						}
    					} else if v, ok := selectColumns[field.Name]; (ok && v) || (!ok && !restricted) {
    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)
  3. tests/serializer_test.go

    	switch value := dbValue.(type) {
    	case []byte:
    		err = field.Set(ctx, dst, bytes.TrimPrefix(value, c.prefix))
    	case string:
    		err = field.Set(ctx, dst, strings.TrimPrefix(value, string(c.prefix)))
    	default:
    		err = fmt.Errorf("unsupported data %#v", dbValue)
    	}
    	return err
    }
    
    func (c *CustomSerializer) Value(ctx context.Context, field *schema.Field, dst reflect.Value, fieldValue interface{}) (interface{}, error) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 21 14:09:38 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  4. callbacks/helper.go

    	for k := range mapValue {
    		keys = append(keys, k)
    	}
    	sort.Strings(keys)
    
    	for _, k := range keys {
    		value := mapValue[k]
    		if stmt.Schema != nil {
    			if field := stmt.Schema.LookUpField(k); field != nil {
    				k = field.DBName
    			}
    		}
    
    		if v, ok := selectColumns[k]; (ok && v) || (!ok && !restricted) {
    			values.Columns = append(values.Columns, clause.Column{Name: k})
    			if len(values.Values) == 0 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 14 12:32:57 GMT 2022
    - 3.7K bytes
    - Viewed (0)
  5. utils/tests/dummy_dialecter.go

    		DeleteClauses:        []string{"DELETE", "FROM", "WHERE", "RETURNING"},
    		LastInsertIDReversed: true,
    	})
    
    	return nil
    }
    
    func (DummyDialector) DefaultValueOf(field *schema.Field) clause.Expression {
    	return clause.Expr{SQL: "DEFAULT"}
    }
    
    func (DummyDialector) Migrator(*gorm.DB) gorm.Migrator {
    	return nil
    }
    
    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)
  6. clause/order_by_test.go

    		},
    		{
    			[]clause.Interface{
    				clause.Select{}, clause.From{}, clause.OrderBy{
    					Expression: clause.Expr{SQL: "FIELD(id, ?)", Vars: []interface{}{[]int{1, 2, 3}}, WithoutParentheses: true},
    				},
    			},
    			"SELECT * FROM `users` ORDER BY FIELD(id, ?,?,?)",
    			[]interface{}{1, 2, 3},
    		},
    	}
    
    	for idx, result := range results {
    		t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  7. interfaces.go

    	"gorm.io/gorm/schema"
    )
    
    // Dialector GORM database dialector
    type Dialector interface {
    	Name() string
    	Initialize(*DB) error
    	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
    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)
  8. schema/field.go

    			field.DataType = ""
    			field.IgnoreMigration = true
    		case "migration":
    			field.IgnoreMigration = true
    		}
    	}
    
    	if v, ok := field.TagSettings["->"]; ok {
    		field.Creatable = false
    		field.Updatable = false
    		if strings.ToLower(v) == "false" {
    			field.Readable = false
    		} else {
    			field.Readable = true
    		}
    	}
    
    	if v, ok := field.TagSettings["<-"]; ok {
    		field.Creatable = true
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  9. tests/non_std_test.go

    	}
    
    	animal = Animal{From: "somewhere"}              // No name fields, should be filled with the default value (galeone)
    	DB.Save(&animal).Update("From", "a nice place") // The name field shoul be untouched
    	DB.First(&animal, animal.Counter)
    	if animal.Name != "galeone" {
    		t.Errorf("Name fields shouldn't be changed if untouched, but got %v", animal.Name)
    	}
    
    	// When changing a field with a default value, the change must occur
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  10. schema/schema.go

    		if fieldStruct := modelType.Field(i); ast.IsExported(fieldStruct.Name) {
    			if field := schema.ParseField(fieldStruct); field.EmbeddedSchema != nil {
    				schema.Fields = append(schema.Fields, field.EmbeddedSchema.Fields...)
    			} else {
    				schema.Fields = append(schema.Fields, field)
    			}
    		}
    	}
    
    	for _, field := range schema.Fields {
    		if field.DBName == "" && field.DataType != "" {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
Back to top