8000 Unable to mock results with datetime columns · Issue #1 · DATA-DOG/go-sqlmock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unable to mock results with datetime columns #1
Closed
@Hebo

Description

@Hebo

Hey,

How can I mock columns that are stored as datetimes? It seems that RowsFromCSVString sets driver.Values that are always []byte, and Scan is unable to parse time.time objects from them:

Scan error on column index 4: unsupported driver -> Scan pair: []uint8 -> *time.Time

I'd guess this would work if either RowsFromCSVString was able to directly create time.time objects when it encounters them or there was another way to assemble sqlmock.rows objects.

Example:

sqlmock.ExpectQuery("SELECT now()").
    WillReturnRows(sqlmock.RowsFromCSVString([]string{"now"}, "2014-02-12 16:04:15.879588-08"))

# sql: Scan error on column index 0: unsupported driver -> Scan pair: []uint8 -> *time.Time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0