Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for sliceok1 (0.06 sec)

  1. callbacks/associations.go

    				isPtr := fieldType.Kind() == reflect.Ptr
    				if !isPtr {
    					fieldType = reflect.PtrTo(fieldType)
    				}
    				elems := reflect.MakeSlice(reflect.SliceOf(fieldType), 0, 10)
    				distinctElems := reflect.MakeSlice(reflect.SliceOf(fieldType), 0, 10)
    				joins := reflect.MakeSlice(reflect.SliceOf(reflect.PtrTo(rel.JoinTable.ModelType)), 0, 10)
    				objs := []reflect.Value{}
    
    				appendToJoins := func(obj reflect.Value, elem reflect.Value) {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Tue Apr 11 03:06:13 UTC 2023
    - 14.3K bytes
    - Viewed (0)
  2. schema/utils.go

    func GetRelationsValues(ctx context.Context, reflectValue reflect.Value, rels []*Relationship) (reflectResults reflect.Value) {
    	for _, rel := range rels {
    		reflectResults = reflect.MakeSlice(reflect.SliceOf(reflect.PtrTo(rel.FieldSchema.ModelType)), 0, 1)
    
    		appendToResults := func(value reflect.Value) {
    			if _, isZero := rel.Field.ValueOf(ctx, value); !isZero {
    				result := reflect.Indirect(rel.Field.ReflectValueOf(ctx, value))
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Aug 19 13:35:14 UTC 2023
    - 5.5K bytes
    - Viewed (0)
  3. tests/upsert_test.go

    			t.Fatalf("failed to update user's updated_at, old: %v, new: %v", user2.UpdatedAt, user3.UpdatedAt)
    		}
    	}
    }
    
    func TestUpsertSlice(t *testing.T) {
    	langs := []Language{
    		{Code: "upsert-slice1", Name: "Upsert-slice1"},
    		{Code: "upsert-slice2", Name: "Upsert-slice2"},
    		{Code: "upsert-slice3", Name: "Upsert-slice3"},
    	}
    	DB.Clauses(clause.OnConflict{DoNothing: true}).Create(&langs)
    
    	var langs2 []Language
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Sep 05 07:39:19 UTC 2022
    - 11.4K bytes
    - Viewed (0)
  4. schema/schema.go

    	}
    	return fmt.Sprintf("%s.%s", schema.ModelType.PkgPath(), schema.ModelType.Name())
    }
    
    func (schema Schema) MakeSlice() reflect.Value {
    	slice := reflect.MakeSlice(reflect.SliceOf(reflect.PointerTo(schema.ModelType)), 0, 20)
    	results := reflect.New(slice.Type())
    	results.Elem().Set(slice)
    
    	return results
    }
    
    func (schema Schema) LookUpField(name string) *Field {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Jun 20 12:19:31 UTC 2024
    - 13.7K bytes
    - Viewed (0)
Back to top