Loading all_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -1435,6 +1435,7 @@ func TestTimeFormat(t *testing.T) { }{ {f: "", w: "2021-01-02 16:39:17.123456789 +0000 UTC"}, {f: "sqlite", w: "2021-01-02 16:39:17.123456789+00:00"}, {f: "datetime", w: "2021-01-02 16:39:17"}, } for _, c := range cases { t.Run("", func(t *testing.T) { Loading conn.go +2 −1 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ func (c *conn) parseTimeString(s0 string, x int) (interface{}, bool) { // by the `_time_format` DSN query param. var writeTimeFormats = map[string]string{ "sqlite": parseTimeFormats[0], "datetime": "2006-01-02 15:04:05", } func (c *conn) formatTime(t time.Time) string { Loading driver.go +6 −5 Original line number Diff line number Diff line Loading @@ -51,11 +51,12 @@ func newDriver() *Driver { return d } // keyword added for you). May be specified more than once, '&'-separated. For more // information on supported PRAGMAs see: https://www.sqlite.org/pragma.html // // _time_format: The name of a format to use when writing time values to the // database. Currently the only supported value is "sqlite" for YYYY-MM-DD HH:MM:SS[+-]HH:MM, // which corresponds to format 4 from https://www.sqlite.org/lang_datefunc.html#time_values, // including the timezone specifier. If this parameter is not specified, then // the default String() format will be used. // _time_format: The name of a format to use when writing time values to the database. // The currently supported values are (1) "sqlite" for YYYY-MM-DD HH:MM:SS.SSS[+-]HH:MM // (format 4 from https://www.sqlite.org/lang_datefunc.html#time_values with sub-second // precision and timezone specifier) and (2) "datetime" for YYYY-MM-DD HH:MM:SS // (format 3, matching the output of SQLite's datetime() function). // If this parameter is not specified, then the default String() format will be used. // // _time_integer_format: The name of a integer format to use when writing time values. // By default, the time is stored as string and the format can be set with _time_format Loading Loading
all_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -1435,6 +1435,7 @@ func TestTimeFormat(t *testing.T) { }{ {f: "", w: "2021-01-02 16:39:17.123456789 +0000 UTC"}, {f: "sqlite", w: "2021-01-02 16:39:17.123456789+00:00"}, {f: "datetime", w: "2021-01-02 16:39:17"}, } for _, c := range cases { t.Run("", func(t *testing.T) { Loading
conn.go +2 −1 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ func (c *conn) parseTimeString(s0 string, x int) (interface{}, bool) { // by the `_time_format` DSN query param. var writeTimeFormats = map[string]string{ "sqlite": parseTimeFormats[0], "datetime": "2006-01-02 15:04:05", } func (c *conn) formatTime(t time.Time) string { Loading
driver.go +6 −5 Original line number Diff line number Diff line Loading @@ -51,11 +51,12 @@ func newDriver() *Driver { return d } // keyword added for you). May be specified more than once, '&'-separated. For more // information on supported PRAGMAs see: https://www.sqlite.org/pragma.html // // _time_format: The name of a format to use when writing time values to the // database. Currently the only supported value is "sqlite" for YYYY-MM-DD HH:MM:SS[+-]HH:MM, // which corresponds to format 4 from https://www.sqlite.org/lang_datefunc.html#time_values, // including the timezone specifier. If this parameter is not specified, then // the default String() format will be used. // _time_format: The name of a format to use when writing time values to the database. // The currently supported values are (1) "sqlite" for YYYY-MM-DD HH:MM:SS.SSS[+-]HH:MM // (format 4 from https://www.sqlite.org/lang_datefunc.html#time_values with sub-second // precision and timezone specifier) and (2) "datetime" for YYYY-MM-DD HH:MM:SS // (format 3, matching the output of SQLite's datetime() function). // If this parameter is not specified, then the default String() format will be used. // // _time_integer_format: The name of a integer format to use when writing time values. // By default, the time is stored as string and the format can be set with _time_format Loading