- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for owner_id (0.16 sec)
-
schema/relationship_test.go
FieldSchema: "Toy", Polymorphic: Polymorphic{ID: "owner_id", Type: "Type", Value: "users"}, References: []Reference{ {ForeignKey: "Type", ForeignSchema: "Toy", PrimaryValue: "users"}, }, }, }, }, }) }) t.Run("has many", func(t *testing.T) { type Toy struct { ID int Name string OwnerID int OwnerType string }
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) -
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 May 05 09:35:13 GMT 2024 - Last Modified: Tue Mar 19 03:50:28 GMT 2024 - 8K bytes - Viewed (0) -
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 May 05 09:35:13 GMT 2024 - Last Modified: Mon Apr 15 03:20:20 GMT 2024 - 22.4K bytes - Viewed (0)