Skip to content

Can't Scan a MySQL datetime to a time.Time #29

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

Closed
peterbourgon opened this issue Jan 31, 2013 · 6 comments
Closed

Can't Scan a MySQL datetime to a time.Time #29

peterbourgon opened this issue Jan 31, 2013 · 6 comments

Comments

@peterbourgon
Copy link

mysql> DESCRIBE foo;
+----------------+--------------+------+-----+-----------+----------------+
| Field          | Type         | Null | Key | Default   | Extra          |
+----------------+--------------+------+-----+-----------+----------------+
  ...
| created_at     | datetime     | YES  | MUL | NULL      |                |
  ...
type MyFoo struct {
    ...
    CreatedAt   time.Time
    ...
}
    rows, err := db.Query(
        `
        SELECT
          ...
            foo.created_at,
          ...
        FROM foo
        WHERE ...
        `,
    )

    err := rows.Scan(
        ...
        &myFoo.CreatedAt,
        ...
sql: Scan error on column index 3: unsupported driver -> Scan pair: []uint8 -> *time.Time
@julienschmidt
Copy link
Member

Duplicate of #9

@muei
Copy link

muei commented Jul 23, 2014

+1

1 similar comment
@leeight
Copy link

leeight commented Sep 22, 2014

+1

@MasashiSalvador57f
Copy link

+1
the issue referred helped me. gracias

@lijianwh
Copy link

lijianwh commented Aug 11, 2017

+10086

@methane
Copy link
Member

methane commented Aug 11, 2017

Why don't you read the response???

All +1 message cause annoying spam mail to maintainers.

@go-sql-driver go-sql-driver locked and limited conversation to collaborators Aug 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants