Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 23 for ID (0.14 sec)

  1. tests/update_test.go

    		return result.Friends[i].ID < result.Friends[j].ID
    	})
    	sort.Slice(result2.Pets, func(i, j int) bool {
    		return result2.Pets[i].ID < result2.Pets[j].ID
    	})
    	sort.Slice(result2.Team, func(i, j int) bool {
    		return result2.Team[i].ID < result2.Team[j].ID
    	})
    	sort.Slice(result2.Friends, func(i, j int) bool {
    		return result2.Friends[i].ID < result2.Friends[j].ID
    	})
    
    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)
  2. finisher_api.go

    	"fmt"
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/logger"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // Create inserts value, returning the inserted data's primary key in value's id
    func (db *DB) Create(value interface{}) (tx *DB) {
    	if db.CreateBatchSize > 0 {
    		return db.CreateInBatches(value, db.CreateBatchSize)
    	}
    
    	tx = db.getInstance()
    	tx.Statement.Dest = value
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  3. tests/scanner_valuer_test.go

    	if result.Age.Int64 != 18 {
    		t.Errorf("should update age to 18")
    	}
    
    	var result2 ScannerValuerStruct
    	if err := DB.First(&result2, result.ID).Error; err != nil {
    		t.Errorf("got error %v when query with %v", err, result.ID)
    	}
    
    	AssertObjEqual(t, result2, result, "ID", "CreatedAt", "UpdatedAt", "Name", "Gender", "Age")
    }
    
    func TestInvalidValuer(t *testing.T) {
    	DB.Migrator().DropTable(&ScannerValuerStruct{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  4. tests/transaction_test.go

    		// callMethod do
    		tx2 := tx1.Find(&User{}).Session(&gorm.Session{NewDB: true})
    		// trx in hooks
    		return tx2.Transaction(func(tx3 *gorm.DB) error {
    			return tx3.Where("user_id", user.ID).Delete(&Account{}).Error
    		})
    	})
    
    	if err != nil {
    		t.Error(err)
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  5. tests/preload_test.go

    	}
    
    	var user2 User
    	DB.Preload("Pets.Toy").Find(&user2, "id = ?", user.ID)
    	CheckUser(t, user2, user)
    
    	var user3 User
    	DB.Preload(clause.Associations+"."+clause.Associations).Find(&user3, "id = ?", user.ID)
    	CheckUser(t, user3, user)
    
    	var user4 *User
    	DB.Preload("Pets.Toy").Find(&user4, "id = ?", user.ID)
    	CheckUser(t, *user4, user)
    }
    
    func TestNestedPreloadForSlice(t *testing.T) {
    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)
  6. schema/schema_test.go

    	}
    
    	fields := []schema.Field{
    		{Name: "ID", DBName: "id", BindNames: []string{"CorpBase", "Model", "ID"}, DataType: schema.Uint, PrimaryKey: true, Size: 64, HasDefaultValue: true, AutoIncrement: true, TagSettings: map[string]string{"PRIMARYKEY": "PRIMARYKEY"}},
    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)
  7. schema/field_test.go

    		"name":       user.Name,
    		"id":         user.ID,
    		"created_at": user.CreatedAt,
    		"deleted_at": user.DeletedAt,
    		"age":        user.Age,
    		"birthday":   user.Birthday,
    		"active":     true,
    	}
    	checkField(t, userSchema, reflectValue, values)
    
    	// test setter
    	newValues := map[string]interface{}{
    		"name":       "valuer_and_setter_2",
    		"id":         2,
    		"created_at": time.Now(),
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  8. tests/multi_primary_keys_test.go

    )
    
    type Blog struct {
    	ID         uint   `gorm:"primary_key"`
    	Locale     string `gorm:"primary_key"`
    	Subject    string
    	Body       string
    	Tags       []Tag `gorm:"many2many:blog_tags;"`
    	SharedTags []Tag `gorm:"many2many:shared_blog_tags;ForeignKey:id;References:id"`
    	LocaleTags []Tag `gorm:"many2many:locale_blog_tags;ForeignKey:id,locale;References:id"`
    }
    
    type Tag struct {
    	ID     uint   `gorm:"primary_key"`
    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)
  9. tests/associations_test.go

    		t.Fatalf("invalid %v count %v, expects: %v got %v", name, reason, result, count)
    	}
    
    	var newUser User
    	if user, ok := data.(User); ok {
    		DB.Find(&newUser, "id = ?", user.ID)
    	} else if user, ok := data.(*User); ok {
    		DB.Find(&newUser, "id = ?", user.ID)
    	}
    
    	if newUser.ID != 0 {
    		if count := DB.Model(&newUser).Association(name).Count(); count != result {
    			t.Fatalf("invalid %v count %v, expects: %v got %v", name, reason, result, count)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 08 08:29:09 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  10. tests/sql_builder_test.go

    		t.Errorf("The second join condition is over written instead of combining")
    	}
    
    	if !strings.Contains(str, "`users`.`company_id` = `companies`.`id`") && !strings.Contains(str, "\"users\".\"company_id\" = \"companies\".\"id\"") {
    		t.Errorf("The first join condition is over written instead of combining")
    	}
    }
    
    func TestToSQL(t *testing.T) {
    	// By default DB.DryRun should false
    	if DB.DryRun {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
Back to top