- Sort Score
- Result 10 results
- Languages All
Results 1 - 9 of 9 for MakeSlice (0.17 sec)
-
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{}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Apr 11 03:06:13 UTC 2023 - 14.3K bytes - Viewed (0) -
callbacks/preload.go
if joined, nestedJoins := isJoined(name); joined { switch rv := db.Statement.ReflectValue; rv.Kind() { case reflect.Slice, reflect.Array: if rv.Len() > 0 { reflectValue := rel.FieldSchema.MakeSlice().Elem() for i := 0; i < rv.Len(); i++ { frv := rel.Field.ReflectValueOf(db.Statement.Context, rv.Index(i)) if frv.Kind() != reflect.Ptr { reflectValue = reflect.Append(reflectValue, frv.Addr())
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:52:33 UTC 2024 - 11.6K bytes - Viewed (0) -
src/arena/arena.go
return runtime_arena_arena_New(a.a, reflectlite.TypeOf((*T)(nil))).(*T) } // MakeSlice creates a new []T with the provided capacity and length. The []T must // not be used after the arena is freed. Accessing the underlying storage of the // slice after free may result in a fault, but this fault is also not guaranteed. func MakeSlice[T any](a *Arena, len, cap int) []T { var sl []T runtime_arena_arena_Slice(a.a, &sl, cap)
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Wed Oct 12 20:23:36 UTC 2022 - 4.3K bytes - Viewed (0) -
src/arena/arena_test.go
) type T1 struct { n int } type T2 [1 << 20]byte // 1MiB func TestSmoke(t *testing.T) { a := arena.NewArena() defer a.Free() tt := arena.New[T1](a) tt.n = 1 ts := arena.MakeSlice[T1](a, 99, 100) if len(ts) != 99 { t.Errorf("Slice() len = %d, want 99", len(ts)) } if cap(ts) != 100 { t.Errorf("Slice() cap = %d, want 100", cap(ts)) } ts[1].n = 42 }
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Wed Oct 12 20:23:36 UTC 2022 - 742 bytes - Viewed (0) -
schema/schema.go
return fmt.Sprintf("%s(%s)", schema.Name, schema.Table) } 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 }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jun 20 12:19:31 UTC 2024 - 13.7K bytes - Viewed (0) -
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 {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Aug 19 13:35:14 UTC 2023 - 5.5K bytes - Viewed (0) -
association.go
var fieldValue reflect.Value if clear { fieldValue = reflect.MakeSlice(oldFieldValue.Type(), 0, oldFieldValue.Cap()) } else { fieldValue = reflect.MakeSlice(oldFieldValue.Type(), oldFieldValue.Len(), oldFieldValue.Cap()) reflect.Copy(fieldValue, oldFieldValue) } appendToFieldValues := func(ev reflect.Value) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 21.5K bytes - Viewed (0) -
scan.go
} else { // if the slice cap is externally initialized, the externally initialized slice is directly used here if reflectValue.Cap() == 0 { db.Statement.ReflectValue.Set(reflect.MakeSlice(reflectValue.Type(), 0, 20)) } else { reflectValue.SetLen(0) db.Statement.ReflectValue.Set(reflectValue) } } } for initialized || rows.Next() { BEGIN:
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 10.1K bytes - Viewed (0) -
api/go1.txt
pkg reflect, func DeepEqual(interface{}, interface{}) bool pkg reflect, func Indirect(Value) Value pkg reflect, func MakeChan(Type, int) Value pkg reflect, func MakeMap(Type) Value pkg reflect, func MakeSlice(Type, int, int) Value pkg reflect, func New(Type) Value pkg reflect, func NewAt(Type, unsafe.Pointer) Value pkg reflect, func PtrTo(Type) Type pkg reflect, func TypeOf(interface{}) Type
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Wed Aug 14 18:58:28 UTC 2013 - 1.7M bytes - Viewed (0)