Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

panic: index out of range when try to .cols("xxx", "xxx", "xxx").find(&map[int64]*xxx) #1396

Open
silver-chard opened this issue Aug 19, 2019 · 0 comments · May be fixed by #1397
Open

panic: index out of range when try to .cols("xxx", "xxx", "xxx").find(&map[int64]*xxx) #1396

silver-chard opened this issue Aug 19, 2019 · 0 comments · May be fixed by #1397
Labels

Comments

@silver-chard
Copy link

return convertAssign(dst, pk[0])

in session_find.go:259 ~ 271

containerValueSetFunc = func(newValue *reflect.Value, pk core.PK) error {
	keyValue := reflect.New(keyType)
	err := convertPKToValue(table, keyValue.Interface(), pk)
	if err != nil {
		return err
	}
	if isPointer {
		containerValue.SetMapIndex(keyValue.Elem(), newValue.Elem().Addr())
	} else {
		containerValue.SetMapIndex(keyValue.Elem(), newValue.Elem())
	}
	return nil
}	

session_find.go:306 containerValueSetFunc(&newValue, nil) . pk will be nil.
but in convertPKToValue. return convertAssign(dst, pk[0])
so ... nil[0] ....

@silver-chard silver-chard changed the title panic: index out of range when try to find(&map[xxx]xxx) panic: index out of range when try to find(&map[int64]*xxx) Aug 19, 2019
@silver-chard silver-chard changed the title panic: index out of range when try to find(&map[int64]*xxx) panic: index out of range when try to .cols("xxx", "xxx", "xxx")find(&map[int64]*xxx) Aug 19, 2019
@silver-chard silver-chard changed the title panic: index out of range when try to .cols("xxx", "xxx", "xxx")find(&map[int64]*xxx) panic: index out of range when try to .cols("xxx", "xxx", "xxx").find(&map[int64]*xxx) Aug 19, 2019
@lunny lunny added the kind/bug label Aug 19, 2019
@lunny lunny linked a pull request Aug 19, 2019 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants