Closed pragyanaryal closed 3 years ago
Hi. Thanks for the issue. What you are asking for should work by default, without any workarounds. What exactly "note in the docs" you are talking about, can you give me the link?
BTW, can you send me the full code version with the struct definition, pgxscan call and the full error.
Hello, Sorry, It was my fault . Data type mismatch between db and go's code was causing the problem. I had implemented int on the database but the field was string on the go's side, upon changing, it behaves fine. It scans fine now as intended. The link in docs I was pointing towards was: https://pkg.go.dev/github.com/georgysavva/scany/pgxscan#hdr-Note_about_pgx_custom_types
Upon reading, it cannot scan into pointer, I was deviated.
But, I was able to scan even to the pointer inside custom type.
I have a nested struct like this, inside which a Location is a custom type:
Upon implementing, decoder and encoder to the Location struct like this:
And, specifying pgxscan to use binary format for the given oid, it successfully scanned into the struct,
And gave result like this:
Thanks, this is really nice package. :)
Hello, I read through the note in doc, but i need to implement some columns as null-able field. Is there any workaround to scan pointer to string using pgxscan ?
My Struct is as such![image](https://user-images.githubusercontent.com/36224537/97797438-28eeec80-1c45-11eb-8b8d-5ed579572368.png)
It is able to scan to pointer in nested struct, which is of composite type, but is not able to scan to plain pointer to nil. Am I missing something ?