Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for CompanyID (0.29 sec)

  1. tests/associations_belongs_to_test.go

    		t.Errorf("Error happened when append company to user, got %v", err)
    	}
    
    	if users[0].CompanyID == nil || users[1].CompanyID == nil || *users[0].CompanyID != *users[1].CompanyID {
    		t.Errorf("user's company id should exists and equal, but its: %v, %v", users[0].CompanyID, users[1].CompanyID)
    	}
    
    	DB.Model(&users[0]).Association("Company").Delete(&company)
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 9.3K bytes
    - Viewed (0)
  2. tests/helper_test.go

    		} else {
    			AssertObjEqual(t, newUser, user, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "Name", "Age", "Birthday",
    				"CompanyID", "ManagerID", "Active")
    		}
    	}
    
    	AssertObjEqual(t, user, expect, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "Name", "Age", "Birthday", "CompanyID",
    		"ManagerID", "Active")
    
    	t.Run("Account", func(t *testing.T) {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  3. utils/tests/models.go

    	Age       uint
    	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;"`
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  4. schema/model_test.go

    )
    
    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"`
    	Languages []*tests.Language `gorm:"many2many:UserSpeak"`
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.1K bytes
    - Viewed (0)
  5. schema/schema_test.go

    		{Name: "Age", DBName: "age", BindNames: []string{"Age"}, DataType: schema.Uint, Size: 64},
    		{Name: "Birthday", DBName: "birthday", BindNames: []string{"Birthday"}, DataType: schema.Time},
    		{Name: "CompanyID", DBName: "company_id", BindNames: []string{"CompanyID"}, DataType: schema.Int, Size: 64},
    		{Name: "ManagerID", DBName: "manager_id", BindNames: []string{"ManagerID"}, DataType: schema.Uint, Size: 64},
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  6. 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")
    	// Bug happens when .Count is called on a query.
    	// Removing the below two lines or downgrading to gorm v1.20.12 will make this test pass.
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  7. tests/update_test.go

    	})
    	sort.Slice(result2.Friends, func(i, j int) bool {
    		return result2.Friends[i].ID < result2.Friends[j].ID
    	})
    
    	AssertObjEqual(t, result2, result, "Age", "Pets", "Company", "CompanyID", "Team", "Friends")
    }
    
    func TestOmitWithUpdateWithMap(t *testing.T) {
    	user := *GetUser("omit_update_map", Config{Account: true, Pets: 3, Toys: 3, Company: true, Manager: true, Team: 3, Languages: 3, Friends: 4})
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  8. schema/relationship_test.go

    		},
    	})
    
    	checkStructRelation(t, &result, Relation{
    		Name: "Company", Type: schema.BelongsTo, Schema: "", FieldSchema: "Company",
    		References: []Reference{
    			{"ID", "Company", "CompanyID", "", "", false},
    		},
    	})
    }
    
    func TestSameForeignKey(t *testing.T) {
    	type UserAux struct {
    		gorm.Model
    		Aux  string
    		UUID string
    	}
    
    	type User struct {
    		gorm.Model
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  9. tests/migrate_test.go

    		}
    
    		if !DB.Migrator().HasConstraint(&User{}, name) {
    			t.Fatalf("failed to found constraint %v", name)
    		}
    	}
    }
    
    type DynamicUser struct {
    	gorm.Model
    	Name      string
    	CompanyID string `gorm:"index"`
    }
    
    // To test auto migrate crate indexes for dynamic table name
    // https://github.com/go-gorm/gorm/issues/4752
    func TestMigrateIndexesWithDynamicTableName(t *testing.T) {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  10. tests/query_test.go

    	if len(results2) != 1 {
    		t.Errorf("Search all records with inline map containing null value finding 1 record")
    	}
    
    	DB.Find(&results2, map[string]interface{}{"name": users[3].Name, "company_id": users[3].CompanyID})
    	if len(results2) != 1 {
    		t.Errorf("Search all records with inline multiple value map")
    	}
    }
    
    func TestSearchWithStruct(t *testing.T) {
    	dryRunDB := DB.Session(&gorm.Session{DryRun: true})
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Mar 15 06:14:48 GMT 2024
    - 49.4K bytes
    - Viewed (0)
Back to top