Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for foreignKeys (0.23 sec)

  1. schema/relationship.go

    	}
    
    	if constraint.OnUpdate != "" {
    		sql += " ON UPDATE " + constraint.OnUpdate
    	}
    
    	foreignKeys := make([]interface{}, 0, len(constraint.ForeignKeys))
    	for _, field := range constraint.ForeignKeys {
    		foreignKeys = append(foreignKeys, clause.Column{Name: field.DBName})
    	}
    
    	references := make([]interface{}, 0, len(constraint.References))
    	for _, field := range constraint.References {
    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)
  2. schema/utils.go

    }
    
    // ToQueryValues to query values
    func ToQueryValues(table string, foreignKeys []string, foreignValues [][]interface{}) (interface{}, []interface{}) {
    	queryValues := make([]interface{}, len(foreignValues))
    	if len(foreignKeys) == 1 {
    		for idx, r := range foreignValues {
    			queryValues[idx] = r[0]
    		}
    
    		return clause.Column{Table: table, Name: foreignKeys[0]}, queryValues
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  3. association.go

    			primaryFields []*schema.Field
    			foreignKeys   []string
    			updateAttrs   = map[string]interface{}{}
    			conds         []clause.Expression
    		)
    
    		for _, ref := range rel.References {
    			if ref.PrimaryValue == "" {
    				primaryFields = append(primaryFields, ref.PrimaryKey)
    				foreignKeys = append(foreignKeys, ref.ForeignKey.DBName)
    				updateAttrs[ref.ForeignKey.DBName] = nil
    			} else {
    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)
  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 May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  5. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  6. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  7. 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 May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 09 14:35:33 GMT 2024
    - 710 bytes
    - Viewed (0)
  8. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  9. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  10. 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 May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 09 14:35:33 GMT 2024
    - 710 bytes
    - Viewed (0)
Back to top