aboutsummaryrefslogtreecommitdiff
path: root/select.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-05-13 00:39:22 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-05-13 00:40:24 +0200
commit2fe6a5a42ccb663211f4f4804b78fff3bd9ebdc0 (patch)
tree08fe0bcc17dcd617d08a14847375710b80d86d8d /select.go
parenta86a346ecceb7ad409f116474c1593b201012cf2 (diff)
downloadgo-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.go8
1 files changed, 4 insertions, 4 deletions
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))