Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

udt: support pointers in auto UDT structs #213

Open
mmatczuk opened this issue Dec 22, 2021 · 0 comments
Open

udt: support pointers in auto UDT structs #213

mmatczuk opened this issue Dec 22, 2021 · 0 comments

Comments

@mmatczuk
Copy link
Contributor

If there is a nil pointer in an automatic UDT struct code panics.

panic({0xeee920, 0x4000370b10})
        runtime/panic.go:1052 +0x2b4
reflect.flag.mustBeAssignableSlow(0x96)
        reflect/value.go:262 +0xac
reflect.flag.mustBeAssignable(...)
        reflect/value.go:249
reflect.Value.Set({0x121f280, 0x400083d6b8, 0x96}, {0x121f280, 0x4000656b58, 0x16})
        reflect/value.go:1899 +0x34
github.com/scylladb/go-reflectx.FieldByIndexes({0x11c5a80, 0x400083d680, 0x99}, {0x40006a89d8, 0x1, 0x1})
        github.com/scylladb/[email protected]/reflect.go:212 +0x15c
github.com/scylladb/go-reflectx.(*Mapper).FieldMap(0x40000a41e0, {0x11c5a80, 0x400083d680, 0x99})
        github.com/scylladb/[email protected]/reflect.go:125 +0x1a8
github.com/scylladb/gocqlx/v2.makeUDT(...)
        github.com/scylladb/gocqlx/[email protected]/udt.go:35
github.com/scylladb/gocqlx/v2.udtWrapSlice(0x40000a41e0, 0x0, {0x40001b1700, 0x8, 0x8})
        github.com/scylladb/gocqlx/[email protected]/udt.go:70 +0x158
github.com/scylladb/gocqlx/v2.(*Queryx).Bind(...)
        github.com/scylladb/gocqlx/[email protected]/queryx.go:213
github.com/scylladb/gocqlx/v2.(*Queryx).BindStruct(0x40002e93c0, {0xffde20, 0x40001fcd00})
        github.com/scylladb/gocqlx/[email protected]/queryx.go:128 +0x138

Gocqlx should support fields of pointer type, allocate memory and handle that gracefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant