How to convert golang and sqlite3 time types automatically

golang time.Time type and sqlite3 text type or integer type can"t be automatically converted when the Scan () method is called?

if not, what is the best practice for storing time type fields, and are there inevitably intermediate fields or manual conversions?

I have the following error in the process of using:

sql: Scan error on column index 5, name \"create_time\": unsupported Scan, storing driver.Value type []uint8 into type *time.Time

the data-driven library uses github.com/mattn/go-sqlite3 , where the golang field type is time.Time , and the field types in sqlite3 are defined as text and integer have been tried.

Jun.07,2022

https://godoc.org/github.com/...

time.Time of

Go corresponds to timestamp/datetime of sqlite. It is recommended to use timestamp/datetime to store time data in sqlite

.

if you still want to use text , read it with String of Go, and then use the standard library to convert it to get time.Time type:

.
  https://golang.org/pkg/time/-sharp...

Menu