Open kevinburkeshyp opened 9 years ago
pq doesn't support JSON, but you may be able to do what you want by defining a Scan function and using json.rawMessage. Example here: (link1, link2)
Just scan the json into a string and go from there.
(or) Arrays are currently not supported. Here are some people who have implemented workarounds: (link1, link2).
See #364, I guess.
Hi @johto - thanks for the quick response... was hoping this could be documented in a more friendly place for everyone? I can clean up what you just wrote and add it to the package docstring?
I can clean up what you just wrote and add it to the package docstring?
shrug I don't mind committing improvements to the docs, but I'm not exactly sure how the case for JSON could be made more clear. I'd rather the docs didn't say anything about JSON in particular, since there's nothing special about it. You can scan any data type into a string, and there's no driver support necessary.
Array support (or lack thereof) on the other hand is something that maybe should be documented, but the godoc-generated page is already a huge mess.
I think this can be closed since #466 was merged and as @johto pointed out you can pass the string to encoding/json
just fine. Please re-open this issue if I am wrong.
Hi, just a heads up that this ticket is still coming up in Google searches that my friends are reporting back to me, so maybe the documentation can still use some work so it ranks higher in Google than this closed issue.
Hi folks I appreciate all of the hard work you put in to making this library.
I know array and JSON field support have been touchy subjects in the past. I was trying to find docs on the current state of support for those two. It would be really nice if there were docs anywhere in the project that said something like
Array types
You can define array types using the following types: int64, string, ... Everything else will raise an error.
(or) Arrays are currently not supported. Here are some people who have implemented workarounds: (link1, link2).
JSON support
pq doesn't support JSON, but you may be able to do what you want by defining a
Scan
function and usingjson.rawMessage
. Example here: (link1, link2)Thanks! Currently struggling with the above and wondering what my options are.