Closed PaulForgey closed 3 years ago
I will take a look at this. Thanks for the issue!
Hi. I just upgraded pgx to v4.8.1 https://github.com/georgysavva/scany/commit/d03fac1ef3c48f83eea39a48af58b17312a3a45a in the master. I don't want to create a new release yet because there are a few things that I want to check first:
Thanks!
import "github.com/google/uuid"
struct MyRecord {
ID *uuid.UUID db:"id"
// pgtype uuid
}
Hi. Thanks for giving me an example. I just checked it with scany v0.2.6 and pgtype v1.3.0 and it works the same way as it works with the latest scany in master and pgtype v1.4.2 So I am not sure what new functionality in pgtype v1.4.0 you are talking about, again :)
Besides that, as far as I understand if you are using scany with go modules, you can install pgtype of the latest version:
go get github.com/jackc/pgtype@v1.4.2
And go modules will force scany to use this, higher version of pgtype, instead of the one defined in its dependencies.
It appears this issue was finally fixed in pgtype, once there's a release tag I will test this out in our codebase (go issue 37438 is making this difficult in the meantime)
also the go get in the module will for that module it is in, but I still need to fork yours to get specific versions of your dependencies in your module.
also the go get in the module will for that module it is in, but I still need to fork yours to get specific versions of your dependencies in your module.
I just checked this and it works as I was saying.
I installed the latest scany release v0.2.6
that uses pgtype v1.3.1
and made scany to scan into a pointer to a slice and it worked.
Then I installed the latest pgtype version in my module:
go get github.com/jackc/pgtype@v1.5.0
And it replaced the pgtype version in scany module too, because when I made scany to scan into a pointer a slice again it didn't work (since this feature is broken in pgtype v1.5.0
).
This proves that go get
will replace the dependency version not only in your module but in your dependencies too.
Closing due to inactivity.
The version of pgx used uses an older version of pgtype which does not support nullable pointers to custom types. Later versions of pgtype >= 1.4.0 support this.