-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
postgres error when inserting slice value #145
Comments
yes, you are correct, rel currently doesn't implicitly handle array types (if you think this will be useful, please feel free to open a pr 😄 ). as an alternative, you can implement Scanner interface to a custom int type, or if you are using lib/pq as the driver, you can just use this type: https://github.com/lib/pq/blob/072e83d238c297c71cab11154695af301010031e/array.go#L501-L517 |
ok thanks that fix my problem update on this https://github.com/go-rel/rel/blob/master/adapter/sql/builder.go#L338 function right? But It's ok to change the adapter function? because I think mysql and sqlite doesn't support for array value cmiiw. |
yes correct, mysql and sqlite doesn't support it, so I think the update should only be specific for postgresql adapter, and I also would like to avoid importing driver package in adapter, to make it driver independent. |
ok. I will try to make pr on this weekend about this |
I have a struct with data
type Example struct { RelatedIDs []int }
when inserting on database. I have error with message
sql: converting argument $8 type: unsupported type []int, a slice of int
. But postgres is already support data type with array. I think it miss implementation on build the query if the data is slice on relThe text was updated successfully, but these errors were encountered: