Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for ref (0.13 sec)

  1. schema/relationship_test.go

    			"Cat": {
    				Relations: map[string]Relation{
    					"Toy": {
    						Name:        "Toy",
    						Type:        schema.HasOne,
    						Schema:      "User",
    						FieldSchema: "Toy",
    						Polymorphic: Polymorphic{ID: "ref_id", Type: "Type", Value: "users"},
    						References: []Reference{
    							{ForeignKey: "Type", ForeignSchema: "Toy", PrimaryValue: "users"},
    						},
    					},
    				},
    			},
    		})
    	})
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  2. callbacks/delete.go

    				)
    
    				for _, ref := range rel.References {
    					if ref.OwnPrimaryKey {
    						foreignFields = append(foreignFields, ref.PrimaryKey)
    						relForeignKeys = append(relForeignKeys, ref.ForeignKey.DBName)
    					} else if ref.PrimaryValue != "" {
    						queryConds = append(queryConds, clause.Eq{
    							Column: clause.Column{Table: rel.JoinTable.Table, Name: ref.ForeignKey.DBName},
    							Value:  ref.PrimaryValue,
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  3. callbacks/associations.go

    									rv = rv.Addr()
    								}
    
    								for _, ref := range rel.References {
    									if ref.OwnPrimaryKey {
    										fv, _ := ref.PrimaryKey.ValueOf(db.Statement.Context, obj)
    										db.AddError(ref.ForeignKey.Set(db.Statement.Context, rv, fv))
    									} else if ref.PrimaryValue != "" {
    										db.AddError(ref.ForeignKey.Set(db.Statement.Context, rv, ref.PrimaryValue))
    									}
    								}
    
    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)
  4. callbacks/preload.go

    		)
    
    		for _, ref := range rel.References {
    			if ref.OwnPrimaryKey {
    				joinForeignKeys = append(joinForeignKeys, ref.ForeignKey.DBName)
    				joinForeignFields = append(joinForeignFields, ref.ForeignKey)
    				foreignFields = append(foreignFields, ref.PrimaryKey)
    			} else if ref.PrimaryValue != "" {
    				tx = tx.Where(clause.Eq{Column: ref.ForeignKey.DBName, Value: ref.PrimaryValue})
    			} else {
    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)
  5. callbacks/query.go

    							for idx, ref := range relation.References {
    								if ref.OwnPrimaryKey {
    									exprs[idx] = clause.Eq{
    										Column: clause.Column{Table: parentTableName, Name: ref.PrimaryKey.DBName},
    										Value:  clause.Column{Table: tableAliasName, Name: ref.ForeignKey.DBName},
    									}
    								} else {
    									if ref.PrimaryValue == "" {
    										exprs[idx] = clause.Eq{
    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. schema/schema_helper_test.go

    			}
    
    			for _, ref := range relation.References {
    				var found bool
    				for _, rf := range r.References {
    					if (rf.PrimaryKey == nil || (rf.PrimaryKey.Name == ref.PrimaryKey && rf.PrimaryKey.Schema.Name == ref.PrimarySchema)) && (rf.PrimaryValue == ref.PrimaryValue) && (rf.ForeignKey.Name == ref.ForeignKey && rf.ForeignKey.Schema.Name == ref.ForeignSchema) && (rf.OwnPrimaryKey == ref.OwnPrimaryKey) {
    						found = true
    					}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  7. association.go

    				}
    			}
    
    			for _, ref := range rel.References {
    				if ref.OwnPrimaryKey {
    					primaryFields = append(primaryFields, ref.PrimaryKey)
    					foreignKeys = append(foreignKeys, ref.ForeignKey.DBName)
    					updateMap[ref.ForeignKey.DBName] = nil
    				} else if ref.PrimaryValue != "" {
    					tx.Where(clause.Eq{Column: ref.ForeignKey.DBName, Value: ref.PrimaryValue})
    				}
    			}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  8. schema/relationship.go

    		OnDelete: settings["ONDELETE"],
    	}
    
    	for _, ref := range rel.References {
    		if ref.PrimaryKey != nil && (rel.JoinTable == nil || ref.OwnPrimaryKey) {
    			constraint.ForeignKeys = append(constraint.ForeignKeys, ref.ForeignKey)
    			constraint.References = append(constraint.References, ref.PrimaryKey)
    
    			if ref.OwnPrimaryKey {
    				constraint.Schema = ref.ForeignKey.Schema
    				constraint.ReferenceSchema = rel.Schema
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
  9. gorm.go

    	}
    
    	for _, ref := range relation.References {
    		f := joinSchema.LookUpField(ref.ForeignKey.DBName)
    		if f == nil {
    			return fmt.Errorf("missing field %s for join table", ref.ForeignKey.DBName)
    		}
    
    		f.DataType = ref.ForeignKey.DataType
    		f.GORMDataType = ref.ForeignKey.GORMDataType
    		if f.Size == 0 {
    			f.Size = ref.ForeignKey.Size
    		}
    		ref.ForeignKey = f
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
Back to top