diff options
author | Mario Trangoni <mjtrangoni@gmail.com> | 2018-04-17 11:13:35 +0200 |
---|---|---|
committer | Mario Trangoni <mjtrangoni@gmail.com> | 2018-04-17 12:33:03 +0200 |
commit | 4bde157d91c6061ab47312761ca440d2b06bdb25 (patch) | |
tree | 4e8599396278df498f00e7b5e4c30f77d575cbf6 | |
parent | fix all gosimple issues (diff) | |
download | golite-4bde157d91c6061ab47312761ca440d2b06bdb25.tar.gz golite-4bde157d91c6061ab47312761ca440d2b06bdb25.tar.xz |
fix all goconst issues
-rw-r--r-- | sqlite3.go | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -141,6 +141,12 @@ var SQLiteTimestampFormats = []string{ "2006-01-02", } +const ( + columnDate string = "date" + columnDatetime string = "datetime" + columnTimestamp string = "timestamp" +) + func init() { sql.Register("sqlite3", &SQLiteDriver{}) } @@ -1039,7 +1045,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error { case C.SQLITE_INTEGER: val := int64(C.sqlite3_column_int64(rc.s.s, C.int(i))) switch rc.decltype[i] { - case "timestamp", "datetime", "date": + case columnTimestamp, columnDatetime, columnDate: var t time.Time // Assume a millisecond unix timestamp if it's 13 digits -- too // large to be a reasonable timestamp in seconds. @@ -1086,7 +1092,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error { s := C.GoStringN((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))), C.int(n)) switch rc.decltype[i] { - case "timestamp", "datetime", "date": + case columnTimestamp, columnDatetime, columnDate: var t time.Time s = strings.TrimSuffix(s, "Z") for _, format := range SQLiteTimestampFormats { |