Skip to content
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

Storing slice of string pointers #242

Closed
oharlem opened this issue Mar 4, 2017 · 2 comments
Closed

Storing slice of string pointers #242

oharlem opened this issue Mar 4, 2017 · 2 comments

Comments

@oharlem
Copy link

oharlem commented Mar 4, 2017

Hi,

Is this possible to work with

type Post struct {
    ...
    AttachedImageIDs   []*string `db:"attached_image_ids"`
   ...
}

( underlying type is varchar(36)[] ) ?

My attempts lead to the following error so far:

panic: Cannot encode []*string into oid 1015 - []*string must implement Encoder or be converted to a string

Thank you!

@jackc
Copy link
Owner

jackc commented Mar 4, 2017

[]string is supported, but []*string is not. strings are already essentially pointers. Is there some reason not to just use []string?

@oharlem
Copy link
Author

oharlem commented Mar 4, 2017

@jackc
Just inherited a codebase with lots of []*string (hello to AWS SDK). No reason beyond that. OK, no problem, looks like some cleanup on my side ahead.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants