Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for Multiple (0.16 sec)

  1. tests/count_test.go

    	}
    
    	DB.Model(&User{}).Where("name = ?", user1.Name).Count(&count1).Or("name in ?", []string{user2.Name, user3.Name}).Count(&count2)
    	if count1 != 1 || count2 != 3 {
    		t.Errorf("multiple count in chain should works")
    	}
    
    	tx := DB.Model(&User{}).Where("name = ?", user1.Name).Session(&gorm.Session{})
    	tx.Count(&count1)
    	tx.Or("name in ?", []string{user2.Name, user3.Name}).Count(&count2)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  2. tests/joins_test.go

    	if len(users3) != 1 {
    		t.Errorf("should find one users using multiple left join conditions, but got %v", len(users3))
    	}
    
    	var users4 []User
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  3. chainable_api.go

    //
    // Use Select when you only want a subset of the fields. By default, GORM will select all fields.
    // Select accepts both string arguments and arrays.
    //
    //	// Select name and age of user using multiple arguments
    //	db.Select("name", "age").Find(&users)
    //	// Select name and age of user using an array
    //	db.Select([]string{"name", "age"}).Find(&users)
    func (db *DB) Select(query interface{}, args ...interface{}) (tx *DB) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  4. tests/preload_suits_test.go

    	}
    }
    
    func TestManyToManyPreloadWithMultiPrimaryKeys(t *testing.T) {
    	if name := DB.Dialector.Name(); name == "sqlite" || name == "sqlserver" {
    		t.Skip("skip sqlite, sqlserver due to it doesn't support multiple primary keys with auto increment")
    	}
    
    	type (
    		Level1 struct {
    			ID           uint   `gorm:"primary_key;"`
    			LanguageCode string `gorm:"primary_key"`
    			Value        string
    		}
    		Level2 struct {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 18 05:38:46 GMT 2022
    - 30.3K bytes
    - Viewed (0)
  5. tests/multi_primary_keys_test.go

    }
    
    func TestManyToManyWithMultiPrimaryKeys(t *testing.T) {
    	if name := DB.Dialector.Name(); name == "sqlite" || name == "sqlserver" {
    		t.Skip("skip sqlite, sqlserver due to it doesn't support multiple primary keys with auto increment")
    	}
    
    	if name := DB.Dialector.Name(); name == "postgres" {
    		stmt := gorm.Statement{DB: DB}
    		stmt.Parse(&Blog{})
    		stmt.Schema.LookUpField("ID").Unique = true
    		stmt.Parse(&Tag{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
  6. schema/schema.go

    	}
    
    	if schema.PrioritizedPrimaryField == nil {
    		if len(schema.PrimaryFields) == 1 {
    			schema.PrioritizedPrimaryField = schema.PrimaryFields[0]
    		} else if len(schema.PrimaryFields) > 1 {
    			// If there are multiple primary keys, the AUTOINCREMENT field is prioritized
    			for _, field := range schema.PrimaryFields {
    				if field.AutoIncrement {
    					schema.PrioritizedPrimaryField = field
    					break
    				}
    			}
    		}
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  7. tests/query_test.go

    	}
    
    	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})
    
    	result := dryRunDB.Where(User{Name: "jinzhu"}).Find(&User{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
Back to top