Insert struct with slice or other struct #2161
Replies: 3 comments 1 reply
-
I don't think you should need to use pgtype.Array. You should be able to pass slices directly. Also, you didn't say what the error message was. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes sorry. It's a simple failed to encoded, because there's a mismatch between string and binary
…-------- Message d'origine --------
Le 6/11/24 01:18, Jack Christensen a écrit :
I don't think you should need to use pgtype.Array. You should be able to pass slices directly.
Also, you didn't say what the error message was.
—
Reply to this email directly, [view it on GitHub](#2161 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AWSLWO7IMDXYEN3DUL6PKA3Z7FN3ZAVCNFSM6AAAAABREZYN7OVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMJWGA3DOMI).
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
That shouldn't be happening. Can you provide a runnable reproduction case? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm trying to insert some struct, the one I have is this one :
It contains basic type, array and slices. I tried to use
CopyFromRows
but I can't make it works.Here's my code
As you can see I tried using pgtype, I also tried specifying more field of pgtype.Array, but that doesn't seem to be the solution. I could simply make a big query string by appending the value, but it's not really pretty neither safe. What are your recommendations ?
Beta Was this translation helpful? Give feedback.
All reactions