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

Error while Scan (time.Time -> *sql.RawBytes) #8

Open
ilgooz opened this issue Jul 4, 2015 · 2 comments
Open

Error while Scan (time.Time -> *sql.RawBytes) #8

ilgooz opened this issue Jul 4, 2015 · 2 comments

Comments

@ilgooz
Copy link

ilgooz commented Jul 4, 2015

type User struct {
  Preferences *Preferences `sql:"-"`
  UpdatedAt time.Time
}

When I perform ScanAliased(&preferences) after ScanAliased(&user) I get this error right after ScanAliased(&preferences) performed:

sql: Scan error on column index 11: unsupported driver -> Scan pair: time.Time -> *sql.RawBytes

I've quickly changed this line as v = &v to avoid the issue but I'm not sure this is the correct way

@ilgooz ilgooz changed the title Error while Scan time.Time -> *sql.RawBytes Error while Scan (time.Time -> *sql.RawBytes) Jul 4, 2015
@kisielk
Copy link
Owner

kisielk commented Jul 4, 2015

What's the definition of Preferences?

@ilgooz
Copy link
Author

ilgooz commented Jul 5, 2015

Preferences struct is consist of a few string, int64, *string and bool.

Let me give you a better view of the issue. I can perform ScanAliased(&user) for select ... from users or ScanAliased(&preferences) for select ... from preferences without any issue.
But when I do ScanAliased(&preferences) for select user...., preferences.... from users left join preferences... I get that error. I guess this is because it skips all the user values with &sql.RawBytes{} to reach preferences but can't skip mysql datatime with it for UpdatedAt. It works ok when I remove UpdatedAt from User struct. I can prepare a test for this if you want. Thanks!

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