Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for assignee (0.19 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/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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  3. 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)
  4. 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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 21 14:09:38 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  5. 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)
  6. 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)
  7. 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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  8. 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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  9. schema/schema.go

    	FieldsByBindName          map[string]*Field // embedded fields is 'Embed.Field'
    	FieldsByDBName            map[string]*Field
    	FieldsWithDefaultDBValue  []*Field // fields with default value assigned by database
    	Relationships             Relationships
    	CreateClauses             []clause.Interface
    	QueryClauses              []clause.Interface
    	UpdateClauses             []clause.Interface
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K 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