Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for Pet (0.15 sec)

  1. tests/associations_has_many_test.go

    	CheckUser(t, user2, user)
    
    	AssertAssociationCount(t, user, "Pets", 3, "AfterAppend")
    
    	pets2 := []Pet{{Name: "pet-has-many-append-1-1"}, {Name: "pet-has-many-append-1-1"}}
    
    	if err := DB.Model(&user2).Association("Pets").Append(&pets2); err != nil {
    		t.Fatalf("Error happened when append pet, got %v", err)
    	}
    
    	for _, pet := range pets2 {
    		pet := pet
    		if pet.ID == 0 {
    			t.Fatalf("Pet's ID should be created")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  2. tests/preload_test.go

    	for idx, user := range users2[0:2] {
    		for _, pet := range user.Pets {
    			if pet.Toy.Name != "" {
    				t.Errorf("No toy should for user %v's pet %v but got %v", idx+1, pet.Name, pet.Toy.Name)
    			}
    		}
    	}
    
    	if len(users2[2].Pets) != 3 {
    		t.Errorf("Invalid pet toys found for user 3 got %v", len(users2[2].Pets))
    	} else {
    		sort.Slice(users2[2].Pets, func(i, j int) bool {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  3. tests/create_test.go

    	t.Run("Struct", func(t *testing.T) {
    		pet := Pet{
    			Name: "PolymorphicHasOne",
    			Toy:  Toy{Name: "Toy-PolymorphicHasOne"},
    		}
    
    		if err := DB.Create(&pet).Error; err != nil {
    			t.Fatalf("errors happened when create: %v", err)
    		}
    
    		CheckPet(t, pet, pet)
    
    		var pet2 Pet
    		DB.Preload("Toy").Find(&pet2, "id = ?", pet.ID)
    		CheckPet(t, pet2, pet)
    	})
    
    	t.Run("Slice", func(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  4. tests/table_test.go

    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    	r = dryDB.Table("(?) as u, (?) as p", DB.Model(&User{}).Select("name"), DB.Model(&Pet{}).Select("name")).Find(&User{}).Statement
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  5. schema/relationship.go

    			}
    			relationships.Relations[relation.Name] = relation
    		}
    	}
    }
    
    // User has many Toys, its `Polymorphic` is `Owner`, Pet has one Toy, its `Polymorphic` is `Owner`
    //
    //	type User struct {
    //	  Toys []Toy `gorm:"polymorphic:Owner;"`
    //	}
    //	type Pet struct {
    //	  Toy Toy `gorm:"polymorphic:Owner;"`
    //	}
    //	type Toy struct {
    //	  OwnerID   int
    //	  OwnerType string
    //	}
    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)
  6. schema/schema_test.go

    			References: []Reference{{"ID", "User", "UserID", "Account", "", true}},
    		},
    		{
    			Name: "Pets", Type: schema.HasMany, Schema: "User", FieldSchema: "Pet",
    			References: []Reference{{"ID", "User", "UserID", "Pet", "", true}},
    		},
    		{
    			Name: "Toys", Type: schema.HasMany, Schema: "User", FieldSchema: "Toy",
    			Polymorphic: Polymorphic{ID: "OwnerID", Type: "OwnerType", Value: "users"},
    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)
  7. docs/en/docs/tutorial/sql-databases.md

    So, `orion_cat.owner.name` could be the name (from the `name` column in the `owners` table) of this pet's owner.
    
    It could have a value like `"Arquilian"`.
    
    And the ORM will do all the work to get the information from the corresponding table *owners* when you try to access it from your pet object.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 29.6K bytes
    - Viewed (0)
  8. docs/zh/docs/tutorial/sql-databases.md

    **FastAPI**可与任何数据库在任何样式的库中一起与 数据库进行通信。
    
    一种常见的模式是使用“ORM”:对象关系映射。
    
    ORM 具有在代码和数据库表(“*关系型”)中的**对象**之间转换(“*映射*”)的工具。
    
    使用 ORM,您通常会在 SQL 数据库中创建一个代表映射的类,该类的每个属性代表一个列,具有名称和类型。
    
    例如,一个类`Pet`可以表示一个 SQL 表`pets`。
    
    该类的每个*实例对象都代表数据库中的一行数据。*
    
    又例如,一个对象`orion_cat`(`Pet`的一个实例)可以有一个属性`orion_cat.type`, 对标数据库中的`type`列。并且该属性的值可以是其它,例如`"cat"`。
    
    这些 ORM 还具有在表或实体之间建立关系的工具(比如创建多表关系)。
    
    这样,您还可以拥有一个属性`orion_cat.owner`,它包含该宠物所有者的数据,这些数据取自另外一个表。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 27K bytes
    - Viewed (0)
  9. docs/em/docs/tutorial/sql-databases.md

    ⚠ ⚓ ⚙️ "🐜": "🎚-🔗 🗺" 🗃.
    
    🐜 ✔️ 🧰 🗜 ("*🗺*") 🖖 *🎚* 📟 & 💽 🏓 ("*🔗*").
    
    ⏮️ 🐜, 👆 🛎 ✍ 🎓 👈 🎨 🏓 🗄 💽, 🔠 🔢 🎓 🎨 🏓, ⏮️ 📛 & 🆎.
    
    🖼 🎓 `Pet` 💪 🎨 🗄 🏓 `pets`.
    
    & 🔠 *👐* 🎚 👈 🎓 🎨 ⏭ 💽.
    
    🖼 🎚 `orion_cat` (👐 `Pet`) 💪 ✔️ 🔢 `orion_cat.type`, 🏓 `type`. & 💲 👈 🔢 💪, ✅ `"cat"`.
    
    👫 🐜 ✔️ 🧰 ⚒ 🔗 ⚖️ 🔗 🖖 🏓 ⚖️ 👨‍💼.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 25.2K bytes
    - Viewed (1)
  10. okhttp/src/main/resources/okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz

    pccw pcloud.host pd.it pdns.page pe pe.ca pe.gov.br pe.it pe.kr pe.leg.br pecori.jp peewee.jp penne.jp penza.su pepper.jp per.la per.nf per.sg perma.jp perso.ht perso.sn perso.tn perspecta.cloud perugia.it pesaro-urbino.it pesarourbino.it pescara.it pet pf pfizer pg.in pg.it pgafan.net pgfog.com ph pharmacien.fr pharmaciens.km pharmacy pharmacy.museum phd philadelphia.museum philadelphiaarea.museum philately.museum philips phoenix.museum phone photo photography photography.museum photos phx.enscaled.us...
    Others
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Dec 20 23:27:07 GMT 2023
    - 40.4K bytes
    - Viewed (0)
Back to top