go.uuid icon indicating copy to clipboard operation
go.uuid copied to clipboard

Can't scan into *uuid.UUID

Open matthewmueller opened this issue 8 years ago • 2 comments

Wondering if it's possible to support scanning into *uuid.UUID. Something like this:

type Team struct {
   ID *uuid.UUID
}

// ...
var team Team
err := row.Scan(&team.ID)

Right now it'll error out with:

can't scan into dest[0]: Scan cannot decode into *uuid.UUID

If I use uuid.NullUUID it does work, but I prefer using pointers in this context.

matthewmueller avatar Apr 02 '17 10:04 matthewmueller

Which version of Go is it? Curious because I can't find where this error is constructed in standard library sources.

satori avatar Apr 03 '17 12:04 satori

@satori Go 1.8, and I'm using pgx, though I'm not sure that would make the difference.

matthewmueller avatar Apr 03 '17 12:04 matthewmueller