Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for selected (0.17 sec)

  1. 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)
    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)
  2. clause/where_test.go

    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Where{
    				Exprs: []clause.Expression{clause.Or(clause.Neq{Column: "name", Value: "jinzhu"}), clause.Eq{Column: clause.PrimaryColumn, Value: "1"}, clause.Gt{Column: "age", Value: 18}},
    			}},
    			"SELECT * FROM `users` WHERE `users`.`id` = ? OR `name` <> ? AND `age` > ?",
    			[]interface{}{"1", "jinzhu", 18},
    		},
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Where{
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  3. tests/query_test.go

    	}
    
    	if user.Name != result2.Name {
    		t.Errorf("Should have user Name when selected it")
    	}
    
    	dryDB := DB.Session(&gorm.Session{DryRun: true})
    	r := dryDB.Select("name", "age").Find(&User{})
    	if !regexp.MustCompile("SELECT .*name.*,.*age.* FROM .*users.*").MatchString(r.Statement.SQL.String()) {
    		t.Fatalf("Build Select with strings, but got %v", r.Statement.SQL.String())
    	}
    
    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)
  4. tests/preload_test.go

    	if len(user3.Pets) != 0 {
    		t.Fatalf("User.Pet[0] was deleted and should not exist.")
    	}
    
    	var user4 *User
    	DB.Preload("Pets.Toy").Find(&user4, "id = ?", user.ID)
    	if len(user4.Pets) != 0 {
    		t.Fatalf("User.Pet[0] was deleted and should not exist.")
    	}
    
    	var user5 User
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
Back to top