diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-05-13 00:39:22 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-05-13 00:40:24 +0200 |
| commit | 2fe6a5a42ccb663211f4f4804b78fff3bd9ebdc0 (patch) | |
| tree | 08fe0bcc17dcd617d08a14847375710b80d86d8d /select.go | |
| parent | a86a346ecceb7ad409f116474c1593b201012cf2 (diff) | |
| download | go-oblast-2fe6a5a42ccb663211f4f4804b78fff3bd9ebdc0.tar.gz | |
Insert, Upsert, Update, Delete: do not panic on indirection through nil pointer
Diffstat (limited to 'select.go')
| -rw-r--r-- | select.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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)) |
