Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for OwnerID (0.25 sec)

  1. schema/schema_test.go

    		{Name: "OwnerID", DBName: "company_owner_id", BindNames: []string{"Base", "OwnerID"}, DataType: schema.Int, Size: 64, TagSettings: map[string]string{"EMBEDDED": "EMBEDDED", "EMBEDDEDPREFIX": "company_"}},
    		{Name: "OwnerID", DBName: "owner_id", BindNames: []string{"CorpBase", "OwnerID"}, DataType: schema.String},
    	}
    
    	for _, f := range fields {
    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)
  2. schema/relationship_test.go

    		}
    	} else {
    		t.Fatalf("expects created by relations, but not found")
    	}
    }
    
    func TestEmbeddedHas(t *testing.T) {
    	type Toy struct {
    		ID        int
    		Name      string
    		OwnerID   int
    		OwnerType string
    	}
    	type User struct {
    		ID  int
    		Cat struct {
    			Name string
    			Toy  Toy   `gorm:"polymorphic:Owner;"`
    			Toys []Toy `gorm:"polymorphic:Owner;"`
    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)
  3. utils/tests/models.go

    	Number string
    }
    
    type Pet struct {
    	gorm.Model
    	UserID *uint
    	Name   string
    	Toy    Toy `gorm:"polymorphic:Owner;"`
    }
    
    type Toy struct {
    	gorm.Model
    	Name      string
    	OwnerID   string
    	OwnerType string
    }
    
    type Tools struct {
    	gorm.Model
    	Name     string
    	CustomID string
    	Type     string
    }
    
    type Company struct {
    	ID   int
    	Name string
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  4. tests/helper_test.go

    		}
    	}
    
    	AssertObjEqual(t, pet, expect, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "UserID", "Name")
    
    	AssertObjEqual(t, pet.Toy, expect.Toy, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "Name", "OwnerID", "OwnerType")
    
    	if expect.Toy.Name != "" && expect.Toy.OwnerType != "pets" {
    		t.Errorf("toys's OwnerType, expect: %v, got %v", "pets", expect.Toy.OwnerType)
    	}
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  5. schema/relationship.go

    //
    //	type User struct {
    //	  Toys []Toy `gorm:"polymorphic:Owner;"`
    //	}
    //	type Pet struct {
    //	  Toy Toy `gorm:"polymorphic:Owner;"`
    //	}
    //	type Toy struct {
    //	  OwnerID   int
    //	  OwnerType string
    //	}
    func (schema *Schema) buildPolymorphicRelation(relation *Relationship, field *Field) {
    	polymorphic := field.TagSettings["POLYMORPHIC"]
    
    	relation.Polymorphic = &Polymorphic{
    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)
Back to top