Skip to content

Could not convert string into time #370

@fairking

Description

@fairking

In one of my query I have the following error:

sql: Scan error on column index 0, name \"last_visited\": unsupported Scan, storing driver.Value type string into type *time.Time

I have reproduced the issue here: fairking/sql@94d95e4

2024/04/18 03:10:34 [duration: 0s op: adapter-query] SELECT MAX(last_visited) last_visited FROM "users" GROUP BY "users"."gender";
    \go-rel\sqlite3\query.go:155:
                Error Trace:    /go-rel/sql/specs/query.go:155
                Error:          Expected nil, but got: &fmt.wrapError{msg:"sql: Scan error on column index 0, name \"last_visited\": unsupported Scan, storing driver.Value type string into type *time.Time", err:(*errors.errorString)(0xc0003ec6c0)}
                Test:           TestAdapter_specs/FindAll#35
--- FAIL: TestAdapter_specs/FindAll#35 (0.00s)

My struct:

type ContactItem struct {
	LastVisited *time.Time `json:"lastVisited"`
}

Any idea why that happen?

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