From 2fe6a5a42ccb663211f4f4804b78fff3bd9ebdc0 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 13 May 2026 00:39:22 +0200 Subject: Insert, Upsert, Update, Delete: do not panic on indirection through nil pointer --- select.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'select.go') diff --git a/select.go b/select.go index 87dd36b..17195d0 100644 --- a/select.go +++ b/select.go @@ -144,8 +144,8 @@ func startSelectWhereQuery(ctx context.Context, db Handle, plan plan, partialQue } func collectRow(rows handle.Rows, plan plan, v reflect.Value, slots []any, indexes [][]int) error { - for _, index := range plan.IndexesOfTransparentPointerStructs { - f := v.FieldByIndex(index) + for _, field := range plan.TransparentPointerStructFields { + f := v.FieldByIndex(field.Index) f.Set(reflect.New(f.Type().Elem())) } for idx, index := range indexes { @@ -232,8 +232,8 @@ func selectOneWhere(ctx context.Context, db Handle, plan plan, v reflect.Value, } func selectOne(ctx context.Context, db Handle, plan plan, v reflect.Value, query string, args []any) error { - for _, index := range plan.IndexesOfTransparentPointerStructs { - f := v.FieldByIndex(index) + for _, field := range plan.TransparentPointerStructFields { + f := v.FieldByIndex(field.Index) f.Set(reflect.New(f.Type().Elem())) } slots := make([]any, len(plan.Select.ScanIndexes)) -- cgit v1.2.3