- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 29 for Pet (0.15 sec)
-
tests/test_response_model_data_filter.py
async def create_user(user: UserCreate): return user @app.get("/pets/{pet_id}", response_model=PetOut) async def read_pet(pet_id: int): user = UserDB( email="******@****.***", hashed_password="secrethashed", ) pet = PetDB(name="Nibbler", owner=user) return pet @app.get("/pets/", response_model=List[PetOut]) async def read_pets(): user = UserDB(
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 1.7K bytes - Viewed (0) -
utils/tests/models.go
// He speaks many languages (many to many) and has many friends (many to many - single-table) // His pet also has one Toy (has one - polymorphic) // NamedPet is a reference to a named `Pet` (has one) type User struct { gorm.Model Name string Age uint Birthday *time.Time Account Account Pets []*Pet NamedPet *Pet Toys []Toy `gorm:"polymorphic:Owner"`
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Dec 15 08:36:08 GMT 2023 - 2.1K bytes - Viewed (0) -
tests/table_test.go
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) -
schema/model_test.go
"time" "gorm.io/gorm" "gorm.io/gorm/utils/tests" ) type User struct { *gorm.Model Name *string Age *uint Birthday *time.Time Account *tests.Account Pets []*tests.Pet Toys []*tests.Toy `gorm:"polymorphic:Owner"` CompanyID *int Company *tests.Company ManagerID *uint Manager *User Team []*User `gorm:"foreignkey:ManagerID"`
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 1.1K bytes - Viewed (0) -
tests/tests_test.go
} else if debug == "false" { db.Logger = db.Logger.LogMode(logger.Silent) } return } func RunMigrations() { var err error allModels := []interface{}{&User{}, &Account{}, &Pet{}, &Company{}, &Toy{}, &Language{}, &Coupon{}, &CouponProduct{}, &Order{}, &Parent{}, &Child{}, &Tools{}} rand.Seed(time.Now().UnixNano())
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Dec 15 08:36:08 GMT 2023 - 3.3K bytes - Viewed (1) -
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) -
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) -
tests/upsert_test.go
} DB.Where(&User{Name: "find or create embedded struct"}).Assign(User{Age: 44, Account: Account{Number: "1231231231"}, Pets: []*Pet{{Name: "first_or_create_pet1"}, {Name: "first_or_create_pet2"}}}).FirstOrCreate(&user8) if err := DB.Where("name = ?", "first_or_create_pet1").First(&Pet{}).Error; err != nil { t.Errorf("has many association should be saved") }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Sep 05 07:39:19 GMT 2022 - 11.4K bytes - Viewed (0) -
docs/en/docs/tutorial/sql-databases.md
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) -
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)