Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for ForeignKey (0.34 sec)

  1. schema/relationship.go

    	if len(relation.foreignKeys) > 0 {
    		ownForeignFields = []*Field{}
    		for _, foreignKey := range relation.foreignKeys {
    			if field := schema.LookUpField(foreignKey); field != nil {
    				ownForeignFields = append(ownForeignFields, field)
    			} else {
    				schema.err = fmt.Errorf("invalid foreign key: %s", foreignKey)
    				return
    			}
    		}
    	}
    
    	if len(relation.primaryKeys) > 0 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
  2. docs_src/sql_databases/sql_app/models.py

    from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
    from sqlalchemy.orm import relationship
    
    from .database import Base
    
    
    class User(Base):
        __tablename__ = "users"
    
        id = Column(Integer, primary_key=True)
        email = Column(String, unique=True, index=True)
        hashed_password = Column(String)
        is_active = Column(Boolean, default=True)
    
        items = relationship("Item", back_populates="owner")
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 09 14:35:33 GMT 2024
    - 710 bytes
    - Viewed (0)
  3. association.go

    									if ref.OwnPrimaryKey || ref.PrimaryValue != "" {
    										association.Error = ref.ForeignKey.Set(association.DB.Statement.Context, fieldValue, reflect.Zero(ref.ForeignKey.FieldType).Interface())
    									} else {
    										association.Error = ref.ForeignKey.Set(association.DB.Statement.Context, data, reflect.Zero(ref.ForeignKey.FieldType).Interface())
    									}
    								}
    							}
    						}
    					}
    				}
    			}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  4. schema/relationship_test.go

    		Name      string
    		UserRefer uint
    	}
    
    	type User struct {
    		gorm.Model
    		Profiles  []Profile `gorm:"many2many:user_profiles;ForeignKey:Refer;JoinForeignKey:UserReferID;References:UserRefer;JoinReferences:ProfileRefer"`
    		Profiles2 []Profile `gorm:"many2many:user_profiles2;ForeignKey:refer;JoinForeignKey:user_refer_id;References:user_refer;JoinReferences:profile_refer"`
    		Refer     uint
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  5. callbacks/associations.go

    								db.AddError(ref.ForeignKey.Set(db.Statement.Context, f, fv))
    							} else if ref.PrimaryValue != "" {
    								db.AddError(ref.ForeignKey.Set(db.Statement.Context, f, ref.PrimaryValue))
    							}
    							assignmentColumns = append(assignmentColumns, ref.ForeignKey.DBName)
    						}
    
    						saveAssociations(db, rel, f, selectColumns, restricted, assignmentColumns)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  6. callbacks/delete.go

    					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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  7. schema/schema_helper_test.go

    				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
    					}
    				}
    
    				if !found {
    					var refs []string
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  8. callbacks/preload.go

    				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 {
    				joinRelForeignFields = append(joinRelForeignFields, ref.ForeignKey)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  9. docs_src/sql_databases/sql_app_py39/models.py

    from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
    from sqlalchemy.orm import relationship
    
    from .database import Base
    
    
    class User(Base):
        __tablename__ = "users"
    
        id = Column(Integer, primary_key=True)
        email = Column(String, unique=True, index=True)
        hashed_password = Column(String)
        is_active = Column(Boolean, default=True)
    
        items = relationship("Item", back_populates="owner")
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 09 14:35:33 GMT 2024
    - 710 bytes
    - Viewed (0)
  10. schema/model_test.go

    	Account   *tests.Account
    	Pets      []*tests.Pet
    	Toys      []*tests.Toy `gorm:"polymorphic:Owner"`
    	CompanyID *int
    	Company   *tests.Company
    	ManagerID *uint
    	Manager   *User
    	Team      []*User           `gorm:"foreignkey:ManagerID"`
    	Languages []*tests.Language `gorm:"many2many:UserSpeak"`
    	Friends   []*User           `gorm:"many2many:user_friends"`
    	Active    *bool
    }
    
    type (
    	mytime time.Time
    	myint  int
    	mybool = bool
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.1K bytes
    - Viewed (0)
Back to top