Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for assignee (0.17 sec)

  1. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  2. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  3. tests/upsert_test.go

    		t.Errorf("user should be found and updated with assigned attrs")
    	}
    
    	DB.Where(&User{Name: "find or create"}).Find(&user7)
    	if user7.Name != "find or create" || user7.ID == 0 || user7.Age != 44 {
    		t.Errorf("user should be found and updated with assigned attrs")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  4. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  5. finisher_api.go

    		}
    
    		// initialize with attrs, conds
    		if len(db.Statement.assigns) > 0 {
    			result.assignInterfacesToValue(db.Statement.assigns...)
    		}
    
    		return tx.Create(dest)
    	} else if len(db.Statement.assigns) > 0 {
    		exprs := tx.Statement.BuildCondition(db.Statement.assigns[0], db.Statement.assigns[1:]...)
    		assigns := map[string]interface{}{}
    		for i := 0; i < len(exprs); i++ {
    			expr := exprs[i]
    
    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)
  6. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  7. tests/serializer_test.go

    			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 {
    		t.Fatalf("failed to query data, got error %v", err)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 21 14:09:38 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  8. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K 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 May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  10. statement.go

    	RaiseErrorOnNotFound bool
    	SkipHooks            bool
    	SQL                  strings.Builder
    	Vars                 []interface{}
    	CurDestIndex         int
    	attrs                []interface{}
    	assigns              []interface{}
    	scopes               []func(*DB) *DB
    }
    
    type join struct {
    	Name     string
    	Conds    []interface{}
    	On       *clause.Where
    	Selects  []string
    	Omits    []string
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
Back to top