Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for hexone (0.14 sec)

  1. schema/relationship_test.go

    		UserRefer uint
    	}
    
    	type User struct {
    		gorm.Model
    		Profile Profile `gorm:"ForeignKey:UserRefer"`
    	}
    
    	checkStructRelation(t, &User{}, Relation{
    		Name: "Profile", Type: schema.HasOne, Schema: "User", FieldSchema: "Profile",
    		References: []Reference{{"ID", "User", "UserRefer", "Profile", "", true}},
    	})
    }
    
    func TestHasOneOverrideReferences(t *testing.T) {
    	type Profile struct {
    		gorm.Model
    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. migrator/migrator.go

    	if uni, ok := uniqueConstraints[name]; ok {
    		return &uni, stmt.Table
    	}
    
    	getTable := func(rel *schema.Relationship) string {
    		switch rel.Type {
    		case schema.HasOne, schema.HasMany:
    			return rel.FieldSchema.Table
    		case schema.Many2Many:
    			return rel.JoinTable.Table
    		}
    		return stmt.Table
    	}
    
    	for _, rel := range stmt.Schema.Relationships.Relations {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  3. schema/schema_test.go

    			f.Creatable = true
    			f.Updatable = true
    			f.Readable = true
    		})
    	}
    
    	// check relations
    	relations := []Relation{
    		{
    			Name: "Account", Type: schema.HasOne, Schema: "User", FieldSchema: "Account",
    			References: []Reference{{"ID", "User", "UserID", "Account", "", true}},
    		},
    		{
    			Name: "Pets", Type: schema.HasMany, Schema: "User", FieldSchema: "Pet",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  4. schema/relationship.go

    		}
    
    		switch field.IndirectFieldType.Kind() {
    		case reflect.Struct:
    			relation.Type = HasOne
    		case reflect.Slice:
    			relation.Type = HasMany
    		}
    	}
    
    	if schema.err == nil {
    		schema.setRelation(relation)
    		switch relation.Type {
    		case HasOne:
    			schema.Relationships.HasOne = append(schema.Relationships.HasOne, relation)
    		case HasMany:
    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)
Back to top