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

Panic on nil pointer to driver.Valuer interface #248

Open
titanproger opened this issue Sep 27, 2022 · 2 comments
Open

Panic on nil pointer to driver.Valuer interface #248

titanproger opened this issue Sep 27, 2022 · 2 comments

Comments

@titanproger
Copy link

titanproger commented Sep 27, 2022

panic when insert or update nil poiter to type wich implements Valuer interface

for example

type record struct {
SomeRelationUuid *uuid.uuid db:"some_relation_uuid"
}

the problem in vendor/github.com/gocraft/dbr/v2/interpolate.go encodePlaceholder

if valuer, ok := value.(driver.Valuer); ok

this code checks is interface implements Valuer - but not check is interface has valid value

@titanproger
Copy link
Author

will make test & PR about it soon

titanproger pushed a commit to titanproger/dbr that referenced this issue Sep 27, 2022
@ilmaruk
Copy link

ilmaruk commented Oct 4, 2023

My bad, I made a PR before checking here and I realise @titanproger has already addressed the same issue.

Just wanted to report we're having the same problem with *uuid.UUID, indeed.

Thanks.

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

2 participants