Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 43 for New (0.12 sec)

  1. tests/migrate_test.go

    		"new_new_name"); err != nil {
    		t.Fatalf("Failed to add column, got %v", err)
    	}
    
    	if !DB.Table("column_structs").Migrator().HasColumn(&NewColumnStruct{}, "new_new_name") {
    		t.Fatalf("Failed to found renamed column")
    	}
    
    	if err := DB.Table("column_structs").Migrator().DropColumn(&NewColumnStruct{}, "new_new_name"); err != nil {
    		t.Fatalf("Failed to add column, got %v", err)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  2. callbacks/delete.go

    			if !ok {
    				continue
    			}
    
    			switch rel.Type {
    			case schema.HasOne, schema.HasMany:
    				queryConds := rel.ToQueryConditions(db.Statement.Context, db.Statement.ReflectValue)
    				modelValue := reflect.New(rel.FieldSchema.ModelType).Interface()
    				tx := db.Session(&gorm.Session{NewDB: true}).Model(modelValue)
    				withoutConditions := false
    				if db.Statement.Unscoped {
    					tx = tx.Unscoped()
    				}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  3. schema/interfaces.go

    	GetName() string
    	Build() (sql string, vars []interface{})
    }
    
    // GormDataTypeInterface gorm data type interface
    type GormDataTypeInterface interface {
    	GormDataType() string
    }
    
    // FieldNewValuePool field new scan value pool
    type FieldNewValuePool interface {
    	Get() interface{}
    	Put(interface{})
    }
    
    // CreateClausesInterface create clauses interface
    type CreateClausesInterface interface {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 980 bytes
    - Viewed (0)
  4. finisher_api.go

    					db.assignInterfacesToValue(exprs)
    				}
    				return
    			}
    		}
    	}
    }
    
    // FirstOrInit finds the first matching record, otherwise if not found initializes a new instance with given conds.
    // Each conds must be a struct or map.
    //
    // FirstOrInit never modifies the database. It is often used with Assign and Attrs.
    //
    //	// assign an email if the record is not found
    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)
  5. tests/scanner_valuer_test.go

    	if b, ok := value.([]byte); ok {
    		if len(b) < 3 || b[0] != '*' || b[1] != '*' || b[2] != '*' {
    			return errors.New("Too short")
    		}
    
    		*data = append((*data)[0:], b[3:]...)
    		return nil
    	} else if s, ok := value.(string); ok {
    		*data = []byte(s[3:])
    		return nil
    	}
    
    	return errors.New("Bytes expected")
    }
    
    func (data EncryptedData) Value() (driver.Value, error) {
    	if len(data) > 0 && data[0] == 'x' {
    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)
  6. tests/update_many2many_test.go

    	var user2 User
    	DB.Preload("Languages").Preload("Friends").Find(&user2, "id = ?", user.ID)
    	CheckUser(t, user2, user)
    
    	for idx := range user.Friends {
    		user.Friends[idx].Name += "new"
    	}
    
    	for idx := range user.Languages {
    		user.Languages[idx].Name += "new"
    	}
    
    	if err := DB.Save(&user).Error; err != nil {
    		t.Fatalf("errors happened when update: %v", err)
    	}
    
    	var user3 User
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.3K bytes
    - Viewed (0)
  7. tests/update_test.go

    	}
    
    	DB.Model(&user.Company).Update("Name", "new company name")
    	if err := DB.Table("users").Where("1 = 1").Update("name", DB.Table("companies").Select("name").Where("companies.id = users.company_id")).Error; err != nil {
    		t.Errorf("failed to update with sub query, got error %v", err)
    	}
    
    	DB.First(&result, user.ID)
    	if result.Name != "new company name" {
    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)
  8. tests/transaction_test.go

    			t.Fatalf("No error should raise")
    		}
    
    		if err := tx.First(&User{}, "name = ?", user.Name).Error; err != nil {
    			t.Fatalf("Should find saved record")
    		}
    
    		return errors.New("the error message")
    	})
    
    	if err != nil && err.Error() != "the error message" {
    		t.Fatalf("Transaction return error will equal the block returns error")
    	}
    
    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)
  9. schema/pool.go

    	"sync"
    )
    
    // sync pools
    var (
    	normalPool      sync.Map
    	poolInitializer = func(reflectType reflect.Type) FieldNewValuePool {
    		v, _ := normalPool.LoadOrStore(reflectType, &sync.Pool{
    			New: func() interface{} {
    				return reflect.New(reflectType).Interface()
    			},
    		})
    		return v.(FieldNewValuePool)
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 11 13:37:44 GMT 2022
    - 345 bytes
    - Viewed (0)
  10. statement_test.go

    	"testing"
    
    	"gorm.io/gorm/clause"
    )
    
    func TestWhereCloneCorruption(t *testing.T) {
    	for whereCount := 1; whereCount <= 8; whereCount++ {
    		t.Run(fmt.Sprintf("w=%d", whereCount), func(t *testing.T) {
    			s := new(Statement)
    			for w := 0; w < whereCount; w++ {
    				s = s.clone()
    				s.AddClause(clause.Where{
    					Exprs: s.BuildCondition(fmt.Sprintf("where%d", w)),
    				})
    			}
    
    			s1 := s.clone()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Dec 23 13:19:41 GMT 2023
    - 1.9K bytes
    - Viewed (0)
Back to top