go-rel / go-rel/rel

Could not convert string into time

Open
#370 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
786
Forks
61
Avg merge
4d 11h
Merged PRs (30d)
2

Description

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: https://github.com/fairking/sql/commit/94d95e48b99def9a489b5a479f1fa899cc3f3eec
```
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:
```go
type ContactItem struct {
LastVisited *time.Time `json:"lastVisited"`
}
```

Any idea why that happen?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.