Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 29 for compact (0.59 sec)

  1. tests/update_belongs_to_test.go

    	}
    
    	user.Company = Company{Name: "company-belongs-to-association"}
    	user.Manager = &User{Name: "manager-belongs-to-association"}
    	if err := DB.Save(&user).Error; err != nil {
    		t.Fatalf("errors happened when update: %v", err)
    	}
    
    	var user2 User
    	DB.Preload("Company").Preload("Manager").Find(&user2, "id = ?", user.ID)
    	CheckUser(t, user2, user)
    
    	user.Company.Name += "new"
    	user.Manager.Name += "new"
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jul 14 06:55:54 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  2. 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" {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue May 30 02:00:48 GMT 2023
    - 7K bytes
    - Viewed (0)
  3. tests/table_test.go

    	dryDB := DB.Session(&gorm.Session{DryRun: true, QueryFields: true})
    	userQuery := "SELECT .*user.*id.*user.*created_at.*user.*updated_at.*user.*deleted_at.*user.*name.*user.*age" +
    		".*user.*birthday.*user.*company_id.*user.*manager_id.*user.*active.* "
    
    	r := dryDB.Table("`user`").Find(&User{}).Statement
    	if !regexp.MustCompile(userQuery + "FROM `user`").MatchString(r.Statement.SQL.String()) {
    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)
  4. tests/migrate_test.go

    		t.Fatalf("Found deleted column")
    	}
    }
    
    func TestMigrateConstraint(t *testing.T) {
    	names := []string{"Account", "fk_users_account", "Pets", "fk_users_pets", "Company", "fk_users_company", "Team", "fk_users_team", "Languages", "fk_users_languages"}
    
    	for _, name := range names {
    		if !DB.Migrator().HasConstraint(&User{}, name) {
    			DB.Migrator().CreateConstraint(&User{}, name)
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  5. tests/helper_test.go

    	}
    
    	for i := 0; i < config.Tools; i++ {
    		user.Tools = append(user.Tools, Tools{Name: name + "_tool_" + strconv.Itoa(i+1)})
    	}
    
    	if config.Company {
    		user.Company = Company{Name: "company-" + name}
    	}
    
    	if config.Manager {
    		user.Manager = GetUser(name+"_manager", Config{})
    	}
    
    	for i := 0; i < config.Team; i++ {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  6. tests/update_test.go

    	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 {
    		t.Fatalf("failed to find created company, got err: %v", err)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  7. clause/from_test.go

    							},
    						}, {
    							Type:  clause.LeftJoin,
    							Table: clause.Table{Name: "companies"},
    							Using: []string{"company_name"},
    						},
    					},
    				},
    			},
    			"SELECT * FROM `users` INNER JOIN `articles` ON `articles`.`id` = `users`.`id` LEFT JOIN `companies` USING (`company_name`)", nil,
    		},
    	}
    
    	for idx, result := range results {
    		t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 15 02:25:10 GMT 2020
    - 1.9K bytes
    - Viewed (0)
  8. tests/scan_test.go

    	}
    
    	var results []result
    	DB.Table("users").Select("name, age").Where("id in ?", []uint{user2.ID, user3.ID}).Scan(&results)
    
    	sort.Slice(results, func(i, j int) bool {
    		return strings.Compare(results[i].Name, results[j].Name) <= -1
    	})
    
    	if len(results) != 2 || results[0].Name != user2.Name || results[1].Name != user3.Name {
    		t.Errorf("Scan into struct map, got %#v", results)
    	}
    
    	type ID uint64
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  9. 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 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 9.3K bytes
    - Viewed (0)
  10. schema/schema_test.go

    		{Name: "ID", DBName: "company_id", BindNames: []string{"Base", "ID"}, DataType: schema.Int, Size: 64, TagSettings: map[string]string{"EMBEDDED": "EMBEDDED", "EMBEDDEDPREFIX": "company_"}},
    		{Name: "Name", DBName: "company_name", BindNames: []string{"Base", "Name"}, DataType: schema.String, TagSettings: map[string]string{"EMBEDDED": "EMBEDDED", "EMBEDDEDPREFIX": "company_"}},
    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)
Back to top