- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 36 for Company (0.08 sec)
-
tests/associations_belongs_to_test.go
// Count AssertAssociationCount(t, user, "Company", 1, "") AssertAssociationCount(t, user, "Manager", 1, "") // Append company := Company{Name: "company-belongs-to-append"} manager := GetUser("manager-belongs-to-append", Config{}) if err := DB.Model(&user2).Association("Company").Append(&company); err != nil { t.Fatalf("Error happened when append Company, got %v", err) } if company.ID == 0 {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 9.3K bytes - Viewed (0) -
tests/joins_test.go
return } } func TestJoinCount(t *testing.T) { companyA := Company{Name: "A"} companyB := Company{Name: "B"} DB.Create(&companyA) DB.Create(&companyB) user := User{Name: "kingGo", CompanyID: &companyB.ID} DB.Create(&user) query := DB.Model(&User{}).Joins("Company") var total int64 query.Count(&total) var result User
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:58:13 UTC 2024 - 15K bytes - Viewed (0) -
tests/create_test.go
} } func TestFirstOrCreateWithPrimaryKey(t *testing.T) { company := Company{ID: 100, Name: "company100_with_primarykey"} DB.FirstOrCreate(&company) if company.ID != 100 { t.Errorf("invalid primary key after creating, got %v", company.ID) } companies := []Company{ {ID: 101, Name: "company101_with_primarykey"}, {ID: 102, Name: "company102_with_primarykey"}, } DB.Create(&companies)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 26.4K bytes - Viewed (0) -
schema/schema_test.go
References: []Reference{{"ID", "User", "OwnerID", "Toy", "", true}, {"", "", "OwnerType", "Toy", "users", false}}, }, { Name: "Company", Type: schema.BelongsTo, Schema: "User", FieldSchema: "Company", References: []Reference{{"ID", "Company", "CompanyID", "User", "", false}}, }, { Name: "Manager", Type: schema.BelongsTo, Schema: "User", FieldSchema: "User",
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jun 20 12:19:31 UTC 2024 - 13.3K bytes - Viewed (0) -
tests/update_test.go
} DB.First(&result, user.ID) if result.Name != "new company name" { t.Errorf("name should be %v, but got %v", user.Company.Name, result.Name) } } func TestIdempotentSave(t *testing.T) { create := Company{ Name: "company_idempotent", } DB.Create(&create) var company Company if err := DB.Find(&company, "id = ?", create.ID).Error; err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Dec 04 03:50:58 UTC 2023 - 30.3K bytes - Viewed (0) -
utils/tests/models.go
Birthday *time.Time Account Account Pets []*Pet NamedPet *Pet Toys []Toy `gorm:"polymorphic:Owner"` Tools []Tools `gorm:"polymorphicType:Type;polymorphicId:CustomID"` CompanyID *int Company Company ManagerID *uint Manager *User Team []User `gorm:"foreignkey:ManagerID"` Languages []Language `gorm:"many2many:UserSpeak;"` Friends []*User `gorm:"many2many:user_friends;"` Active bool }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Dec 15 08:36:08 UTC 2023 - 2.1K bytes - Viewed (0) -
tests/delete_test.go
*GetUser("delete_slice_with_associations1", Config{Account: true, Pets: 4, Toys: 1, Company: true, Manager: true, Team: 1, Languages: 1, Friends: 4}), *GetUser("delete_slice_with_associations2", Config{Account: true, Pets: 3, Toys: 2, Company: true, Manager: true, Team: 2, Languages: 2, Friends: 3}), *GetUser("delete_slice_with_associations3", Config{Account: true, Pets: 2, Toys: 3, Company: true, Manager: true, Team: 3, Languages: 3, Friends: 2}),
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Oct 10 07:03:34 UTC 2023 - 9.4K bytes - Viewed (0) -
tests/helper_test.go
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 8K bytes - Viewed (0) -
tests/associations_test.go
user := *GetUser("TestAssociationError", Config{Pets: 2, Company: true, Account: true, Languages: 2}) DB.Create(&user) var user1 User DB.Preload("Company").Preload("Pets").Preload("Account").Preload("Languages").First(&user1) var emptyUser User var err error // belongs to err = DB.Model(&emptyUser).Association("Company").Delete(&user1.Company) AssertEqual(t, err, gorm.ErrPrimaryKeyRequired) // has many
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 08 08:29:09 UTC 2023 - 10.9K bytes - Viewed (0) -
schema/naming_test.go
} joinTable2 := ns.JoinTableName("UserLanguage") if joinTable2 != "public.user_language" { t.Errorf("invalid join table generated, got %v", joinTable2) } tableName := ns.TableName("Company") if tableName != "public.company" { t.Errorf("invalid table name generated, got %v", tableName) } columdName := ns.ColumnName("", "NameCID") if columdName != "name_cid" {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue May 30 02:00:48 UTC 2023 - 7K bytes - Viewed (0)