Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 18 of 18 for Account (0.14 sec)

  1. migrator/migrator.go

    func (m Migrator) HasTable(value interface{}) bool {
    	var count int64
    
    	m.RunWithValue(value, func(stmt *gorm.Statement) error {
    		currentDatabase := m.DB.Migrator().CurrentDatabase()
    		return m.DB.Raw("SELECT count(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = ? AND table_type = ?", currentDatabase, stmt.Table, "BASE TABLE").Row().Scan(&count)
    	})
    
    	return count > 0
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  2. finisher_api.go

    	}
    
    	if len(tx.Statement.Selects) == 0 {
    		tx.Statement.AddClause(clause.Select{Expression: clause.Expr{SQL: "count(*)"}})
    	} else if !strings.HasPrefix(strings.TrimSpace(strings.ToLower(tx.Statement.Selects[0])), "count(") {
    		expr := clause.Expr{SQL: "count(*)"}
    
    		if len(tx.Statement.Selects) == 1 {
    			dbName := tx.Statement.Selects[0]
    			fields := strings.FieldsFunc(dbName, utils.IsValidDBNameChar)
    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. schema/schema_test.go

    			f.Creatable = true
    			f.Updatable = true
    			f.Readable = true
    		})
    	}
    
    	// check relations
    	relations := []Relation{
    		{
    			Name: "Account", Type: schema.HasOne, Schema: "User", FieldSchema: "Account",
    			References: []Reference{{"ID", "User", "UserID", "Account", "", true}},
    		},
    		{
    			Name: "Pets", Type: schema.HasMany, Schema: "User", FieldSchema: "Pet",
    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)
  4. tests/associations_test.go

    	. "gorm.io/gorm/utils/tests"
    )
    
    func AssertAssociationCount(t *testing.T, data interface{}, name string, result int64, reason string) {
    	if count := DB.Model(data).Association(name).Count(); count != result {
    		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 {
    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)
  5. tests/multi_primary_keys_test.go

    	if !compareTags(blog.Tags, []string{"tag1", "tag2", "tag3"}) {
    		t.Fatalf("Blog should has three tags after Append")
    	}
    
    	if count := DB.Model(&blog).Association("Tags").Count(); count != 3 {
    		t.Fatalf("Blog should has 3 tags after Append, got %v", count)
    	}
    
    	var tags []Tag
    	DB.Model(&blog).Association("Tags").Find(&tags)
    	if !compareTags(tags, []string{"tag1", "tag2", "tag3"}) {
    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. tests/associations_many2many_test.go

    	}
    
    	count := 3
    
    	var languages []Language
    	for i := 0; i < count; i++ {
    		language := Language{Code: fmt.Sprintf("consurrent %d", i)}
    		db.Create(&language)
    		languages = append(languages, language)
    	}
    
    	user := User{}
    	db.Create(&user)
    	db.Preload("Languages").FirstOrCreate(&user)
    
    	var wg sync.WaitGroup
    	for i := 0; i < count; i++ {
    		wg.Add(1)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 13.2K bytes
    - Viewed (0)
  7. tests/sql_builder_test.go

    	if err != nil {
    		t.Errorf("Not error should happen, got %v", err)
    	}
    
    	count := 0
    	for rows.Next() {
    		var name string
    		var age int64
    		rows.Scan(&name, &age)
    		count++
    	}
    
    	if count != 2 {
    		t.Errorf("Should found two records")
    	}
    }
    
    func TestRaw(t *testing.T) {
    	user1 := User{Name: "ExecRawSqlUser1", Age: 1}
    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)
  8. association.go

    	return association.Error
    }
    
    func (association *Association) Clear() error {
    	return association.Replace()
    }
    
    func (association *Association) Count() (count int64) {
    	if association.Error == nil {
    		association.Error = association.buildCondition().Count(&count).Error
    	}
    	return
    }
    
    type assignBack struct {
    	Source reflect.Value
    	Index  int
    	Dest   reflect.Value
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
Back to top