Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for Cassin (0.18 sec)

  1. tests/scanner_valuer_test.go

    	}
    
    	if tx.Error != nil {
    		t.Errorf("Should not raise any error, but got %v", tx.Error)
    	}
    
    	AssertObjEqual(t, result, data, "Name", "Gender", "Age")
    
    	if err := DB.Where(data).Assign(ScannerValuerStruct{Age: sql.NullInt64{Int64: 18, Valid: true}}).FirstOrCreate(&result).Error; err != nil {
    		t.Errorf("Should not raise any error, but got %v", err)
    	}
    
    	if result.Age.Int64 != 18 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  2. tests/prepared_stmt_test.go

    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestPreparedStmt(t *testing.T) {
    	tx := DB.Session(&gorm.Session{PrepareStmt: true})
    
    	if _, ok := tx.ConnPool.(*gorm.PreparedStmtDB); !ok {
    		t.Fatalf("should assign PreparedStatement Manager back to database when using PrepareStmt mode")
    	}
    
    	ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
    	defer cancel()
    	txCtx := tx.WithContext(ctx)
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  3. callbacks.go

    	if len(stmt.BuildClauses) == 0 {
    		stmt.BuildClauses = p.Clauses
    		resetBuildClauses = true
    	}
    
    	if optimizer, ok := db.Statement.Dest.(StatementModifier); ok {
    		optimizer.ModifyStatement(stmt)
    	}
    
    	// assign model values
    	if stmt.Model == nil {
    		stmt.Model = stmt.Dest
    	} else if stmt.Dest == nil {
    		stmt.Dest = stmt.Model
    	}
    
    	// parse model values
    	if stmt.Model != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  4. tests/upsert_test.go

    	DB.Where(&User{Name: "find or create 3"}).Assign("age", 55).FirstOrCreate(&user4)
    
    	if user4.Age != 55 {
    		t.Errorf("Failed to set change to 55, got %v", user4.Age)
    	}
    
    	if updatedAt1.Format(time.RFC3339Nano) == user4.UpdatedAt.Format(time.RFC3339Nano) {
    		t.Errorf("UpdateAt should be changed when update values with assign")
    	}
    
    	DB.Where(&User{Name: "find or create 4"}).Assign(User{Age: 44}).FirstOrCreate(&user4)
    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)
  5. chainable_api.go

    	tx.Statement.attrs = attrs
    	return
    }
    
    // Assign provide attributes used in [FirstOrCreate] or [FirstOrInit]
    //
    // Assign adds attributes even if the record is found. If using FirstOrCreate, this means that
    // records will be updated even if they are found.
    //
    //	// assign an email regardless of if the record is not found
    //	db.Where(User{Name: "non_existing"}).Assign(User{Email: "******@****.***"}).FirstOrInit(&user)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  6. finisher_api.go

    // FirstOrInit never modifies the database. It is often used with Assign and Attrs.
    //
    //	// assign an email if the record is not found
    //	db.Where(User{Name: "non_existing"}).Attrs(User{Email: "******@****.***"}).FirstOrInit(&user)
    //	// user -> User{Name: "non_existing", Email: "******@****.***"}
    //
    //	// assign email regardless of if record is found
    //	db.Where(User{Name: "jinzhu"}).Assign(User{Email: "******@****.***"}).FirstOrInit(&user)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  7. schema/field_test.go

    		"birthday":   time.Now(),
    		"active":     f,
    	}
    
    	for k, v := range newValues {
    		if err := userSchema.FieldsByDBName[k].Set(context.Background(), reflectValue, v); err != nil {
    			t.Errorf("no error should happen when assign value to field %v, but got %v", k, err)
    		}
    	}
    	newValues["updated_at"] = time.Time{}
    	newValues["active"] = false
    	checkField(t, userSchema, reflectValue, newValues)
    
    	// test valuer and other type
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  8. tests/serializer_test.go

    			Number:   9920,
    			Location: "Shadyside",
    			IsIntern: false,
    		},
    		CustomSerializerString: "world",
    	}
    
    	// first time insert record
    	out := SerializerStruct{}
    	if err := DB.Assign(data).FirstOrCreate(&out).Error; err != nil {
    		t.Fatalf("failed to FirstOrCreate Assigned data, got error %v", err)
    	}
    
    	var result SerializerStruct
    	if err := DB.First(&result, out.ID).Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 21 14:09:38 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  9. callbacks/preload.go

    			fieldValues[idx], _ = field.ValueOf(tx.Statement.Context, elem)
    		}
    
    		datas, ok := identityMap[utils.ToStringKey(fieldValues...)]
    		if !ok {
    			return fmt.Errorf("failed to assign association %#v, make sure foreign fields exists", elem.Interface())
    		}
    
    		for _, data := range datas {
    			reflectFieldValue := rel.Field.ReflectValueOf(tx.Statement.Context, data)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  10. association.go

    	Dest   reflect.Value
    }
    
    func (association *Association) saveAssociation(clear bool, values ...interface{}) {
    	var (
    		reflectValue = association.DB.Statement.ReflectValue
    		assignBacks  []assignBack // assign association values back to arguments after save
    	)
    
    	appendToRelations := func(source, rv reflect.Value, clear bool) {
    		switch association.Relationship.Type {
    		case schema.HasOne, schema.BelongsTo:
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
Back to top