Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for Reconfig (0.2 sec)

  1. tests/helper_test.go

    	}
    
    	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++ {
    		user.Team = append(user.Team, *GetUser(name+"_team_"+strconv.Itoa(i+1), Config{}))
    	}
    
    	for i := 0; i < config.Languages; i++ {
    		name := name + "_locale_" + strconv.Itoa(i+1)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  2. tests/transaction_test.go

    		t.Fatalf("Should find saved record")
    	}
    }
    
    func TestNestedTransactionWithBlock(t *testing.T) {
    	var (
    		user  = *GetUser("transaction-nested", Config{})
    		user1 = *GetUser("transaction-nested-1", Config{})
    		user2 = *GetUser("transaction-nested-2", Config{})
    	)
    
    	if err := DB.Transaction(func(tx *gorm.DB) error {
    		tx.Create(&user)
    
    		if err := tx.First(&User{}, "name = ?", user.Name).Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  3. tests/update_test.go

    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/utils"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdate(t *testing.T) {
    	var (
    		users = []*User{
    			GetUser("update-1", Config{}),
    			GetUser("update-2", Config{}),
    			GetUser("update-3", Config{}),
    		}
    		user          = users[1]
    		lastUpdatedAt time.Time
    	)
    
    	checkUpdatedAtChanged := func(name string, n time.Time) {
    		if n.UnixNano() == lastUpdatedAt.UnixNano() {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  4. tests/associations_has_one_test.go

    		t.Errorf("account's number should not be saved")
    	}
    }
    
    func TestHasOneAssociationForSlice(t *testing.T) {
    	users := []User{
    		*GetUser("slice-hasone-1", Config{Account: true}),
    		*GetUser("slice-hasone-2", Config{Account: false}),
    		*GetUser("slice-hasone-3", Config{Account: true}),
    	}
    
    	DB.Create(&users)
    
    	// Count
    	AssertAssociationCount(t, users, "Account", 2, "")
    
    	// Find
    	var accounts []Account
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
  5. tests/update_many2many_test.go

    package tests_test
    
    import (
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdateMany2ManyAssociations(t *testing.T) {
    	user := *GetUser("update-many2many", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Languages = []Language{{Code: "zh-CN", Name: "Chinese"}, {Code: "en", Name: "English"}}
    	for _, lang := range user.Languages {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.3K bytes
    - Viewed (0)
  6. tests/distinct_test.go

    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestDistinct(t *testing.T) {
    	users := []User{
    		*GetUser("distinct", Config{}),
    		*GetUser("distinct", Config{}),
    		*GetUser("distinct", Config{}),
    		*GetUser("distinct-2", Config{}),
    		*GetUser("distinct-3", Config{}),
    	}
    	users[0].Age = 20
    
    	if err := DB.Create(&users).Error; err != nil {
    		t.Fatalf("errors happened when create users: %v", err)
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2.5K bytes
    - Viewed (0)
  7. callbacks/create_test.go

    			Name:  "alice",
    			Email: "email",
    			Age:   18,
    		},
    		{
    			ID:    2,
    			Name:  "bob",
    			Email: "email",
    			Age:   19,
    		},
    	}
    	stmt := &gorm.Statement{
    		DB: &gorm.DB{
    			Config: &gorm.Config{
    				NowFunc: func() time.Time { return time.Time{} },
    			},
    			Statement: &gorm.Statement{
    				Settings: sync.Map{},
    				Schema:   s,
    			},
    		},
    		ReflectValue: reflect.ValueOf(dest),
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  8. tests/scopes_test.go

    	return func(d *gorm.DB) *gorm.DB {
    		return d.Where("name in (?)", names)
    	}
    }
    
    func TestScopes(t *testing.T) {
    	users := []*User{
    		GetUser("ScopeUser1", Config{}),
    		GetUser("ScopeUser2", Config{}),
    		GetUser("ScopeUser3", Config{}),
    	}
    
    	DB.Create(&users)
    
    	var users1, users2, users3 []User
    	DB.Scopes(NameIn1And2).Find(&users1)
    	if len(users1) != 2 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  9. migrator/migrator.go

    // TODO:? Create const vars for raw sql queries ?
    
    var _ gorm.Migrator = (*Migrator)(nil)
    
    // Migrator m struct
    type Migrator struct {
    	Config
    }
    
    // Config schema config
    type Config struct {
    	CreateIndexAfterCreateTable bool
    	DB                          *gorm.DB
    	gorm.Dialector
    }
    
    type printSQLLogger struct {
    	logger.Interface
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  10. tests/upsert_test.go

    			t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    		}
    	}
    
    	user := *GetUser("upsert_on_conflict", Config{})
    	user.Age = 20
    	if err := DB.Create(&user).Error; err != nil {
    		t.Errorf("failed to create user, got error %v", err)
    	}
    
    	var user2 User
    	DB.First(&user2, user.ID)
    	user2.Age = 30
    	time.Sleep(time.Second)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
Back to top