Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for checkSchemaRelation (0.21 sec)

  1. schema/schema_helper_test.go

    }
    
    type Reference struct {
    	PrimaryKey    string
    	PrimarySchema string
    	ForeignKey    string
    	ForeignSchema string
    	PrimaryValue  string
    	OwnPrimaryKey bool
    }
    
    func checkSchemaRelation(t *testing.T, s *schema.Schema, relation Relation) {
    	t.Run("CheckRelation/"+relation.Name, func(t *testing.T) {
    		if r, ok := s.Relationships.Relations[relation.Name]; ok {
    			if r.Name != relation.Name {
    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)
  2. schema/schema_test.go

    				},
    			}},
    			References: []Reference{{"ID", "User", "UserID", "user_friends", "", true}, {"ID", "User", "FriendID", "user_friends", "", false}},
    		},
    	}
    
    	for _, relation := range relations {
    		checkSchemaRelation(t, user, relation)
    	}
    }
    
    func TestParseSchemaWithAdvancedDataType(t *testing.T) {
    	user, err := schema.Parse(&AdvancedDataTypeUser{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  3. schema/relationship_test.go

    	if s, err := schema.Parse(data, &sync.Map{}, schema.NamingStrategy{}); err != nil {
    		t.Errorf("Failed to parse schema, got error %v", err)
    	} else {
    		for _, rel := range relations {
    			checkSchemaRelation(t, s, rel)
    		}
    	}
    }
    
    func TestBelongsToOverrideForeignKey(t *testing.T) {
    	type Profile struct {
    		gorm.Model
    		Name string
    	}
    
    	type User struct {
    		gorm.Model
    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)
Back to top