-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
storing driver.Value type string into type *time.Time #951
Comments
SQLite3 (the C library) does not have a data type for date/time specifically. https://www.sqlite.org/datatype3.html#date_and_time_datatype Sometimes this wrapper library is able to hide that particular fact, but only if you are directly selecting a column declared as I don't know the specifics of how For now, your best bet is to scan into a string, and then parse that into a |
Seems this is a known issue that is unlikely to ever be fixed. https://sqlite.org/forum/forumpost/725537a489a04d1e?t=h @mattn Given this sort of issue seems to come up from time to time, it might be helpful to (1) add a typedef to this library that implements |
I've only briefly looked at the source, but it appears to use This seems like a straightforward thing to resolve. The serialization/deserialization of |
On the way into the database, it converts Line 1893 in 8543684
On the way out of the database, if the column type is date/datetime/timestamp, it will try parsing it with various format strings, the first of which is also "2006-01-02 15:04:05.999999999-07:00". Lines 2166 to 2174 in 8543684
So it will be symmetrical, if the column in question has the proper type declaration. |
Hello all,
I am trying to rebuild an application with the
RETURNING
clause introduced in version 3.35.https://www.sqlite.org/lang_returning.html
However, I always get an error that it does not match the data types
unsupported Scan, storing driver.Value type string into type *time.Time
.I have reproduced the whole thing in the following projects and would like you to have a look at it to tell me if it is a bug of mine or if the library can't handle it.
https://github.com/volker-raschek/go-sqlite3-time
The text was updated successfully, but these errors were encountered: